]> git.baikalelectronics.ru Git - kernel.git/commit
hpsa: correct check for non-disk devices
authorDon Brace <don.brace@pmcs.com>
Wed, 4 Nov 2015 21:51:08 +0000 (15:51 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 9 Nov 2015 17:34:20 +0000 (12:34 -0500)
commite37aeea848c76468b98740dafdd2fcc685390ab5
tree96e831bb115a82dea81a04bd2292ba71677a395b
parent4d84333f7fcd3ed29418d504d6d8651723efa303
hpsa: correct check for non-disk devices

The driver is using two MACROs which seemingly are looking in
the wrong location for the device_flags returned from
CISS_REPORT_PHYS. Both MACROs, NON_DISK_PHYS_DEV and
PHYS_IOACCEL, are using the pointer returned from figure_lunaddrbytes
which is the address of the LUN.lunid element in
the extended CISS_REPORT_PHYS.  But the MACROS are using offsets
beyond the range of the element (offset 17 of an 8 byte element).

These MACROs actually are looking at the correct location but
they fail static checker analysis. It also will not work
if any new elements are added to the extended LUN structure.

Change the code to use the structure elements directly
since this MACRO is only used in one location.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hpsa.c
drivers/scsi/hpsa_cmd.h