Re: [PATCH 5/8] scsi: remove the sense and sense_len fields from struct scsi_request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 23, 2022 at 03:39:58PM -0800, Bart Van Assche wrote:
> On 2/22/22 06:04, Christoph Hellwig wrote:
>> @@ -613,10 +614,10 @@ static int sg_scsi_ioctl(struct request_queue *q, fmode_t mode,
>>     	err = req->result & 0xff;	/* only 8 bit SCSI status */
>>   	if (err) {
>> -		if (req->sense_len && req->sense) {
>> -			bytes = (OMAX_SB_LEN > req->sense_len) ?
>> -				req->sense_len : OMAX_SB_LEN;
>> -			if (copy_to_user(sic->data, req->sense, bytes))
>> +		if (scmd->sense_len && scmd->sense_buffer) {
>> +			bytes = (OMAX_SB_LEN > scmd->sense_len) ?
>> +				scmd->sense_len : OMAX_SB_LEN;
>> +			if (copy_to_user(sic->data, scmd->sense_buffer, bytes))
>>   				err = -EFAULT;
>>   		}
>>   	} else {
>
> This change would be a good opportunity to remove the two superfluous 
> parentheses from the above code.

Or switch to use the min or min_t macro, yes.

>
>> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
>> index 3e432e25645ac..47add5b32f460 100644
>> --- a/include/scsi/scsi_cmnd.h
>> +++ b/include/scsi/scsi_cmnd.h
>> @@ -112,6 +112,7 @@ struct scsi_cmnd {
>>   				   reconnects.   Probably == sector
>>   				   size */
>>   +	unsigned sense_len;
>>   	unsigned char *sense_buffer;
>>   				/* obtained by REQUEST SENSE when
>>   				 * CHECK CONDITION is received on original
>
> Isn't "unsigned int" preferred over "unsigned" in new code?

checkpatch states that, but for absolutely no reason.



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux