qemu/hw/ssi
Philippe Mathieu-Daudé 1cb169b27a hw/ssi/npcm7xx_fiu: Fix handling of unsigned integer
Fix integer handling issues handling issue reported by Coverity:

  hw/ssi/npcm7xx_fiu.c: 162 in npcm7xx_fiu_flash_read()
  >>>     CID 1432730:  Integer handling issues  (NEGATIVE_RETURNS)
  >>>     "npcm7xx_fiu_cs_index(fiu, f)" is passed to a parameter that cannot be negative.
  162         npcm7xx_fiu_select(fiu, npcm7xx_fiu_cs_index(fiu, f));

  hw/ssi/npcm7xx_fiu.c: 221 in npcm7xx_fiu_flash_write()
  218         cs_id = npcm7xx_fiu_cs_index(fiu, f);
  219         trace_npcm7xx_fiu_flash_write(DEVICE(fiu)->canonical_path, cs_id, addr,
  220                                       size, v);
  >>>     CID 1432729:  Integer handling issues  (NEGATIVE_RETURNS)
  >>>     "cs_id" is passed to a parameter that cannot be negative.
  221         npcm7xx_fiu_select(fiu, cs_id);

Since the index of the flash can not be negative, return an
unsigned type.

Reported-by: Coverity (CID 1432729 & 1432730: NEGATIVE_RETURNS)
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Havard Skinnemoen <hskinnemoen@google.com>
Message-id: 20200919132435.310527-1-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-08 15:24:32 +01:00
..
aspeed_smc.c aspeed/smc: Open AHB window of the second chip of the AST2600 FMC controller 2020-09-01 14:21:51 +02:00
imx_spi.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00
Kconfig ssi: express dependencies with kconfig 2019-03-07 21:45:53 +01:00
meson.build hw/ssi: NPCM7xx Flash Interface Unit device model 2020-09-14 14:24:59 +01:00
mss-spi.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00
npcm7xx_fiu.c hw/ssi/npcm7xx_fiu: Fix handling of unsigned integer 2020-10-08 15:24:32 +01:00
omap_spi.c Include hw/irq.h a lot less 2019-08-16 13:31:52 +02:00
pl022.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
ssi.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
stm32f2xx_spi.c Include migration/vmstate.h less 2019-08-16 13:31:52 +02:00
trace-events hw/ssi/npcm7xx_fiu: Fix handling of unsigned integer 2020-10-08 15:24:32 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
xilinx_spi.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
xilinx_spips.c ssi: ssi_auto_connect_slaves() never does anything, drop 2020-06-15 22:05:28 +02:00