Re: [PATCH 02/15] scsi: add scsi_{get,put}_internal_cmd() helper

Hannes Reinecke
2021-11-30T06:51:38Z

On 11/30/21 5:17 AM, Martin K. Petersen wrote:
>
> Hannes,
>
>> I have oriented myself at __scsi_execute(), which also has
>> 'data_direction' as an integer. Presumably to avoid header clutter.
>> Martin?
>
> Just a vestige from ancient times. I really hate scsi_execute() and its
> 10,000 randomly ordered arguments. The more sanity checking we have in
> that department, the better.
>
> At some point I proposed having scsi_execute() take a single struct as
> argument to get better input validation. I've lost count how many things
> have been broken because of misordered arguments to this function.
> Backporting patches almost inevitably causes regressions because of this
> interface.
>
Right. As it so happens, I've already created a patch to include
<linux/dma-direction.h> here.
But yeah, the arguments to __scsi_execute are patently horrible.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer