diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2020-10-02 18:10:33 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-10-02 17:58:52 -0600 |
commit | f5ace5ef37b1e1de49882248656f35c45e041585 (patch) | |
tree | 196851df93305c1d8483f09437dd4eb36688bee7 /block | |
parent | 99ba84c5de1e2f5b2b78e9e3bc89e50ec9bc0f29 (diff) | |
download | lwn-f5ace5ef37b1e1de49882248656f35c45e041585.tar.gz lwn-f5ace5ef37b1e1de49882248656f35c45e041585.zip |
block: scsi_ioctl: Avoid the use of one-element arrays
One-element arrays are being deprecated[1]. Replace the one-element array
with a simple object of type compat_caddr_t: 'compat_caddr_t unused'[2],
once it seems this field is actually never used.
Also, update struct cdrom_generic_command in UAPI by adding an
anonimous union to avoid using the one-element array _reserved_.
[1] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays
[2] https://github.com/KSPP/linux/issues/86
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/lkml/5f76f5d0.qJ4t%2FHWuRzSW7bTa%25lkp@intel.com/
Build-tested-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/scsi_ioctl.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index 4421e61c1af1..227f489aeaa5 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c @@ -651,7 +651,7 @@ struct compat_cdrom_generic_command { unsigned char data_direction; compat_int_t quiet; compat_int_t timeout; - compat_caddr_t reserved[1]; + compat_caddr_t unused; }; #endif @@ -673,7 +673,7 @@ static int scsi_get_cdrom_generic_arg(struct cdrom_generic_command *cgc, .data_direction = cgc32.data_direction, .quiet = cgc32.quiet, .timeout = cgc32.timeout, - .reserved[0] = compat_ptr(cgc32.reserved[0]), + .unused = compat_ptr(cgc32.unused), }; memcpy(&cgc->cmd, &cgc32.cmd, CDROM_PACKET_SIZE); return 0; @@ -698,7 +698,7 @@ static int scsi_put_cdrom_generic_arg(const struct cdrom_generic_command *cgc, .data_direction = cgc->data_direction, .quiet = cgc->quiet, .timeout = cgc->timeout, - .reserved[0] = (uintptr_t)(cgc->reserved[0]), + .unused = (uintptr_t)(cgc->unused), }; memcpy(&cgc32.cmd, &cgc->cmd, CDROM_PACKET_SIZE); |