The promised min_t() cleanup. Purely cosmetic. This attached patch is against current scsi-misc-2.6 *after* http://marc.info/?l=linux-scsi&m=120020681219191&w=2 is applied. James, sorry if this patch is being submitted too early in the pipeline ... ObligatoryDisclaimer: Please accept my condolences regarding Outlook's handling of patch attachments. Signed-off-by: Mark Salyzyn <aacraid@xxxxxxxxxxx> drivers/scsi/aacraid/aachba.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) Sincerely -- Mark Salyzyn > -----Original Message----- > From: linux-scsi-owner@xxxxxxxxxxxxxxx > [mailto:linux-scsi-owner@xxxxxxxxxxxxxxx] On Behalf Of Salyzyn, Mark > Sent: Monday, January 14, 2008 8:24 AM > To: 'FUJITA Tomonori'; 'James.Bottomley@xxxxxxxxxxxxxxxxxxxxx' > Cc: 'linux-scsi@xxxxxxxxxxxxxxx'; 'fujita.tomonori@xxxxxxxxxxxxx' > Subject: RE: [PATCH 2/2] replace sizeof sense_buffer with > SCSI_SENSE_BUFFERSIZE > > ACK on ips, aacraid and dpt_i2o bits. Cursory inspection of > other bits as well. Thanks Fujita, looks good! > > Will do a 'min()' cleanup on aacraid once patch propagates > into scsi-misc-2.6 > > Sincerely -- Mark Salyzyn > > cur*so*ry - adjective > going rapidly over something, without noticing > details; hasty; superficial. spedd reeding > > . . . > > o This is a 'grep and replace' style patch but cleans up > dpt_i2o a bit > > as by permission of Mark (I use min macro). > > > > o The previous version overlooked some sizeof sense_buffer lines in > > aacraid and qla4xxx. > . . . > > diff --git a/drivers/scsi/aacraid/aachba.c > > b/drivers/scsi/aacraid/aachba.c > > index 62d9516..aadedbd 100644 > > --- a/drivers/scsi/aacraid/aachba.c > > +++ b/drivers/scsi/aacraid/aachba.c > > @@ -912,8 +912,8 @@ static int aac_bounds_32(struct aac_dev * > > dev, struct scsi_cmnd * cmd, u64 lba) > > ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, > > 0, 0); > > memcpy(cmd->sense_buffer, > > &dev->fsa_dev[cid].sense_data, > > - (sizeof(dev->fsa_dev[cid].sense_data) > > > sizeof(cmd->sense_buffer)) > > - ? sizeof(cmd->sense_buffer) > > + (sizeof(dev->fsa_dev[cid].sense_data) > > > SCSI_SENSE_BUFFERSIZE) > > + ? SCSI_SENSE_BUFFERSIZE > > : sizeof(dev->fsa_dev[cid].sense_data)); > > cmd->scsi_done(cmd); > > return 1; > > @@ -1525,8 +1525,8 @@ static void io_callback(void *context, > > struct fib * fibptr) > > > > ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, > > 0, 0); > > memcpy(scsicmd->sense_buffer, > > &dev->fsa_dev[cid].sense_data, > > - (sizeof(dev->fsa_dev[cid].sense_data) > > > sizeof(scsicmd->sense_buffer)) > > - ? sizeof(scsicmd->sense_buffer) > > + (sizeof(dev->fsa_dev[cid].sense_data) > > > SCSI_SENSE_BUFFERSIZE) > > + ? SCSI_SENSE_BUFFERSIZE > > : sizeof(dev->fsa_dev[cid].sense_data)); > > } > > aac_fib_complete(fibptr); > > @@ -1739,8 +1739,8 @@ static void synchronize_callback(void > > *context, struct fib *fibptr) > > > > ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, > > 0, 0); > > memcpy(cmd->sense_buffer, > > &dev->fsa_dev[cid].sense_data, > > - min(sizeof(dev->fsa_dev[cid].sense_data), > > - sizeof(cmd->sense_buffer))); > > + min_t(size_t, > > sizeof(dev->fsa_dev[cid].sense_data), > > + SCSI_SENSE_BUFFERSIZE)); > > } > > > > aac_fib_complete(fibptr); > > @@ -1949,8 +1949,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) > > SENCODE_INVALID_COMMAND, > > ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); > > memcpy(scsicmd->sense_buffer, > > &dev->fsa_dev[cid].sense_data, > > - (sizeof(dev->fsa_dev[cid].sense_data) > > > sizeof(scsicmd->sense_buffer)) > > - ? sizeof(scsicmd->sense_buffer) > > + (sizeof(dev->fsa_dev[cid].sense_data) > > > SCSI_SENSE_BUFFERSIZE) > > + ? SCSI_SENSE_BUFFERSIZE > > : sizeof(dev->fsa_dev[cid].sense_data)); > > scsicmd->scsi_done(scsicmd); > > return 0; > > @@ -2002,8 +2002,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) > > memcpy(scsicmd->sense_buffer, > > &dev->fsa_dev[cid].sense_data, > > > > (sizeof(dev->fsa_dev[cid].sense_data) > > > - sizeof(scsicmd->sense_buffer)) > > - ? > sizeof(scsicmd->sense_buffer) > > + SCSI_SENSE_BUFFERSIZE) > > + ? SCSI_SENSE_BUFFERSIZE > > : > > sizeof(dev->fsa_dev[cid].sense_data)); > > } > > scsicmd->scsi_done(scsicmd); > > @@ -2259,8 +2259,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) > > ILLEGAL_REQUEST, > > SENCODE_INVALID_COMMAND, > > ASENCODE_INVALID_COMMAND, > 0, 0, 0, 0); > > memcpy(scsicmd->sense_buffer, > > &dev->fsa_dev[cid].sense_data, > > - > > (sizeof(dev->fsa_dev[cid].sense_data) > > sizeof(scsicmd->sense_buffer)) > > - ? sizeof(scsicmd->sense_buffer) > > + > > (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE) > > + ? SCSI_SENSE_BUFFERSIZE > > : sizeof(dev->fsa_dev[cid].sense_data)); > > scsicmd->scsi_done(scsicmd); > > return 0; > > @@ -2422,8 +2422,8 @@ static void aac_srb_callback(void > > *context, struct fib * fibptr) > > int len; > > printk(KERN_WARNING "aac_srb_callback: srb > > failed, status = %d\n", le32_to_cpu(srbreply->status)); > > len = (le32_to_cpu(srbreply->sense_data_size) > > > - sizeof(scsicmd->sense_buffer)) ? > > - sizeof(scsicmd->sense_buffer) : > > + SCSI_SENSE_BUFFERSIZE) ? > > + SCSI_SENSE_BUFFERSIZE : > > > > le32_to_cpu(srbreply->sense_data_size); > > scsicmd->result = DID_ERROR << 16 | > > COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; > > memcpy(scsicmd->sense_buffer, > > srbreply->sense_data, len); > > @@ -2528,8 +2528,8 @@ static void aac_srb_callback(void > > *context, struct fib * fibptr) > > int len; > > scsicmd->result |= SAM_STAT_CHECK_CONDITION; > > len = (le32_to_cpu(srbreply->sense_data_size) > > > - sizeof(scsicmd->sense_buffer)) ? > > - sizeof(scsicmd->sense_buffer) : > > + SCSI_SENSE_BUFFERSIZE) ? > > + SCSI_SENSE_BUFFERSIZE : > > > > le32_to_cpu(srbreply->sense_data_size); > > #ifdef AAC_DETAILED_STATUS_INFO > > printk(KERN_WARNING "aac_srb_callback: check > > condition, status = %d len=%d\n",
Attachment:
aacraid_min.patch
Description: aacraid_min.patch