* Fix Coverity issues in mcf5208evb and nubus machines

* Add URLs for mcf5208evb datasheets
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmbdl4gTHGh1dGhAdHV4
 ZmFtaWx5Lm9yZwAKCRAu2dd0/nAttaRsD/9qqE75Glk1/BYtbI5N4E1Q30vC9lTl
 /R+gOJod44E6/xeOgvvpliCTzsnrHM3sfk2n/EBoEUfQ3Ci3UqZe+wmBgsj+Wv4H
 IIM5Aviq05dwj0B2mgqFFpXLV/ilVTpl3vpkBL82hLmZH+5xre4P/qgn4JwwAAAi
 7quHBcYCwTALB0bizaGj7djwABF7cThkI5z0qE46spju4N6YflfYOE3oRmcqW9Di
 gM5G5CcbJkUmAxeRpBaS+fD/pXjFgYSqZsfjHwaRBQLG+LLdy+EmNiS1UUBvZeE2
 J5w82qaFly+UMXcYEuOxApVP3Mf1M2sG4o2qoQaqGtvqjBvaXVwbUFcVEgYePZEf
 oRweSPjZTarsSCPx/11UOKPz9j3wh5wFME+j8I2TdOl5IZkYp1pL9hpls/Jyz+Ii
 /0JfWna8MlDEpoo/e0sNA+IEcg340BiNqBFMgWkl1TvzKyOJcSorlbbpq1rE0kr0
 Y2+g/rr9hEVh1E+Yla6Me7GOcNUvT77yhrpTdagX6NG7qZfJ4tB0/hADeZ6ic+sC
 Xf48RtD3uzAknBy9awL/hIJWx2sKrS36E01EZj8KvokQzhKawfU16P0++l1DMq9J
 9npALGPIhpYm6JNTr4FZYd+88+ZEQEKkAjJ+a6t7/+gY5PINfRICpGMZtGB6LRvu
 NjVGIGuKHBYTPw==
 =3Pn7
 -----END PGP SIGNATURE-----

Merge tag 'pull-request-2024-09-08' of https://gitlab.com/huth/qemu into staging

* Fix Coverity issues in mcf5208evb and nubus machines
* Add URLs for mcf5208evb datasheets

# -----BEGIN PGP SIGNATURE-----
#
# iQJHBAABCAAxFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmbdl4gTHGh1dGhAdHV4
# ZmFtaWx5Lm9yZwAKCRAu2dd0/nAttaRsD/9qqE75Glk1/BYtbI5N4E1Q30vC9lTl
# /R+gOJod44E6/xeOgvvpliCTzsnrHM3sfk2n/EBoEUfQ3Ci3UqZe+wmBgsj+Wv4H
# IIM5Aviq05dwj0B2mgqFFpXLV/ilVTpl3vpkBL82hLmZH+5xre4P/qgn4JwwAAAi
# 7quHBcYCwTALB0bizaGj7djwABF7cThkI5z0qE46spju4N6YflfYOE3oRmcqW9Di
# gM5G5CcbJkUmAxeRpBaS+fD/pXjFgYSqZsfjHwaRBQLG+LLdy+EmNiS1UUBvZeE2
# J5w82qaFly+UMXcYEuOxApVP3Mf1M2sG4o2qoQaqGtvqjBvaXVwbUFcVEgYePZEf
# oRweSPjZTarsSCPx/11UOKPz9j3wh5wFME+j8I2TdOl5IZkYp1pL9hpls/Jyz+Ii
# /0JfWna8MlDEpoo/e0sNA+IEcg340BiNqBFMgWkl1TvzKyOJcSorlbbpq1rE0kr0
# Y2+g/rr9hEVh1E+Yla6Me7GOcNUvT77yhrpTdagX6NG7qZfJ4tB0/hADeZ6ic+sC
# Xf48RtD3uzAknBy9awL/hIJWx2sKrS36E01EZj8KvokQzhKawfU16P0++l1DMq9J
# 9npALGPIhpYm6JNTr4FZYd+88+ZEQEKkAjJ+a6t7/+gY5PINfRICpGMZtGB6LRvu
# NjVGIGuKHBYTPw==
# =3Pn7
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun 08 Sep 2024 13:24:40 BST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "huth@tuxfamily.org"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2024-09-08' of https://gitlab.com/huth/qemu:
  hw/nubus/nubus-device: Range check 'slot' property
  hw/m68k/mcf5208: Add URLs for datasheets
  hw/m68k/mcf5208: Avoid shifting off end of integer

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2024-09-09 10:47:24 +01:00
commit f2aee60305
2 changed files with 16 additions and 1 deletions

View File

@ -4,6 +4,14 @@
* Copyright (c) 2007 CodeSourcery. * Copyright (c) 2007 CodeSourcery.
* *
* This code is licensed under the GPL * This code is licensed under the GPL
*
* This file models both the MCF5208 SoC, and the
* MCF5208EVB evaluation board. For details see
*
* "MCF5208 Reference Manual"
* https://www.nxp.com/docs/en/reference-manual/MCF5208RM.pdf
* "M5208EVB-RevB 32-bit Microcontroller User Manual"
* https://www.nxp.com/docs/en/reference-manual/M5208EVBUM.pdf
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
@ -158,7 +166,7 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,
{ {
int n; int n;
for (n = 0; n < 32; n++) { for (n = 0; n < 32; n++) {
if (current_machine->ram_size < (2u << n)) { if (current_machine->ram_size < (2ULL << n)) {
break; break;
} }
} }

View File

@ -35,6 +35,13 @@ static void nubus_device_realize(DeviceState *dev, Error **errp)
uint8_t *rom_ptr; uint8_t *rom_ptr;
int ret; int ret;
if (nd->slot < 0 || nd->slot >= NUBUS_SLOT_NB) {
error_setg(errp,
"'slot' value %d out of range (must be between 0 and %d)",
nd->slot, NUBUS_SLOT_NB - 1);
return;
}
/* Super */ /* Super */
slot_offset = nd->slot * NUBUS_SUPER_SLOT_SIZE; slot_offset = nd->slot * NUBUS_SUPER_SLOT_SIZE;