ata: libata-scsi: fix result type of ata_ioc32()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Fri, 24 Jun 2022 20:39:44 +0000 (23:39 +0300)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Wed, 29 Jun 2022 01:44:48 +0000 (10:44 +0900)
commit0184898dd14d53e81cc439b6735260f19750e3c1
treea027194060fed5528af6ce6b098f7b4eddbeec3c
parent2b5960a0e33b5449712abc9a1b144d7ac874e47c
ata: libata-scsi: fix result type of ata_ioc32()

While ata_ioc32() returns 'int', its result gets assigned to and compared
with the 'unsigned long' variable 'val' in ata_sas_scsi_ioctl(), its only
caller, which implies a problematic implicit cast (with sign extension).
Fix this by returning 'bool' instead -- the implicit cast then implies
zero extension which is OK.  Note that actually the object code doesn't
change because ata_ioc32() is always inlined -- I can see the expected
code changes with 'noinline'...

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
drivers/ata/libata-scsi.c