Fix |/|| confusion in fusion driver
Subsystems (2)
PATCH 10/28 Fix |/|| confusion in fusion driver
From: Dirk Mueller <[email protected]>
This patch corrects a |/|| confusion in mptscsih_copy_sense_data. Using || means that the data that ends up being written is (almost always) 1, instead of being bit-wise or'ed.
---
drivers/message/fusion/mptscsih.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/message/fusion/mptscsih.c renamed from drivers/message/fusion/mptscsih.c~fix--confusion-in-fusion-driver +3 -3
@@ -2463,9 +2463,9 @@ mptscsih_copy_sense_data(struct scsi_cmn ioc->events[idx].event =MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE ; ioc->events[idx].eventContext = ioc->eventContext; - ioc->events[idx].data[0 ] = (pReq->LUN[1 ] <<24 ) || - (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA <<16 ) || - (sc->device->channel <<8 ) || sc->device->id; + ioc->events[idx].data[0 ] = (pReq->LUN[1 ] <<24 ) | + (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA <<16 ) | + (sc->device->channel <<8 ) | sc->device->id; ioc->events[idx].data[1 ] = (sense_data[13 ] <<8 ) || sense_data[12 ];
_
Quoted 5 lines · Andrew Morton
From: Dirk Mueller <[email protected]>
This patch corrects a |/|| confusion in
mptscsih_copy_sense_data. Using || means that the data that ends up being written is (almost always) 1, instead of being bit-wise or'ed.
Andrew, the last time this was posted, Eric picked up on some other flaws in the same area. James asked him to followup with a patch, but unless I'm mistaken, that never arrived.
This diff should replace the one in your tree until Eric has an equivalent or better.
drivers/message/fusion/mptbase.h +1 -1
@@ -436,7 +436,7 @@ typedef struct _MPT_SAS_MGMT {typedef struct _mpt_ioctl_events {u32 event;/* Specified by define above */ u32 eventContext;/* Index or counter */ -int data[2 ];/* First 8 bytes of Event Data */ +u32 data[2 ];/* First 8 bytes of Event Data */ }MPT_IOCTL_EVENTS ;/*
drivers/message/fusion/mptscsih.c +4 -4
@@ -2463,11 +2463,11 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR ioc->events[idx].event =MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE ; ioc->events[idx].eventContext = ioc->eventContext; - ioc->events[idx].data[0 ] = (pReq->LUN[1 ] <<24 ) || - (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA <<16 ) || - (sc->device->channel <<8 ) || sc->device->id; + ioc->events[idx].data[0 ] = (pReq->LUN[1 ] <<24 ) | + (MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA <<16 ) | + (sc->device->channel <<8 ) | sc->device->id; - ioc->events[idx].data[1 ] = (sense_data[13 ] <<8 ) || sense_data[12 ]; + ioc->events[idx].data[1 ] = (sense_data[13 ] <<8 ) | sense_data[12 ]; ioc->eventContext++; if (hd->ioc->pcidev->vendor ==
Signature · 1 line
http://www.codemonkey.org.uk
Quoted 9 lines · Dave Jones
Andrew, the last time this was posted, Eric picked up on some other flaws in the same area. James asked him to followup with a patch, but unless I'm mistaken, that never arrived.
This diff should replace the one in your tree until Eric has an equivalent or better.Signed-off-by Dave Jones <[email protected]>
ACK
Thanks Dave, this patch will work.