diff for duplicates of <a66f8abb84444cf79b818011667bc825@AcuMS.aculab.com>
diff --git a/a/1.txt b/N1/1.txt
index cf98c3a..b2ac238 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -1,38 +1,38 @@
From: Stephen Kitt
> Sent: 09 March 2018 22:34
->=20
+>
> COMMAND_SIZE currently uses an array of values in block/scsi_ioctl.c.
> A number of device_handler functions use this to initialise arrays,
> and this is flagged by -Wvla.
->=20
+>
> This patch replaces COMMAND_SIZE with a variant using a formula which
> can be resolved at compile time in cases where the opcode is fixed,
> resolving the array size and avoiding the VLA. The downside is that
> the code is less maintainable and that some call sites end up having
> more complex generated code.
->=20
+>
> Since scsi_command_size_tbl is dropped, we can remove the dependency
> on BLK_SCSI_REQUEST from drivers/target/Kconfig.
->=20
+>
> This was prompted by https://lkml.org/lkml/2018/3/7/621
->=20
+>
> Signed-off-by: Stephen Kitt <steve@sk2.org>
> ---
> block/scsi_ioctl.c | 8 --------
> drivers/target/Kconfig | 1 -
> include/scsi/scsi_common.h | 13 +++++++++++--
> 3 files changed, 11 insertions(+), 11 deletions(-)
->=20
+>
> diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
> index 60b471f8621b..b9e176e537be 100644
> --- a/block/scsi_ioctl.c
> +++ b/block/scsi_ioctl.c
> @@ -41,14 +41,6 @@ struct blk_cmd_filter {
->=20
+>
> static struct blk_cmd_filter blk_default_cmd_filter;
->=20
+>
> -/* Command group 3 is reserved and should never be used. */
-> -const unsigned char scsi_command_size_tbl[8] =3D
+> -const unsigned char scsi_command_size_tbl[8] =
> -{
> - 6, 10, 10, 12,
> - 16, 12, 10, 10
@@ -40,7 +40,7 @@ From: Stephen Kitt
> -EXPORT_SYMBOL(scsi_command_size_tbl);
> -
> #include <scsi/sg.h>
->=20
+>
> static int sg_get_version(int __user *p)
> diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig
> index 4c44d7bed01a..b5f05b60cf06 100644
@@ -61,19 +61,16 @@ From: Stephen Kitt
> @@ -15,8 +15,17 @@ scsi_varlen_cdb_length(const void *hdr)
> return ((struct scsi_varlen_cdb_hdr *)hdr)->additional_cdb_length + 8;
> }
->=20
+>
> -extern const unsigned char scsi_command_size_tbl[8];
> -#define COMMAND_SIZE(opcode) scsi_command_size_tbl[((opcode) >> 5) & 7]
> +/*
-> + * SCSI command sizes are as follows, in bytes, for fixed size commands,=
- per
+> + * SCSI command sizes are as follows, in bytes, for fixed size commands, per
> + * group: 6, 10, 10, 12, 16, 12, 10, 10. The top three bits of an opcode
> + * determine its group.
-> + * The size table is encoded into a 32-bit value by subtracting each val=
-ue
+> + * The size table is encoded into a 32-bit value by subtracting each value
> + * from 16, resulting in a value of 1715488362
-> + * (6 << 28 + 6 << 24 + 4 << 20 + 0 << 16 + 4 << 12 + 6 << 8 + 6 << 4 + =
-10).
+> + * (6 << 28 + 6 << 24 + 4 << 20 + 0 << 16 + 4 << 12 + 6 << 8 + 6 << 4 + 10).
> + * Command group 3 is reserved and should never be used.
> + */
> +#define COMMAND_SIZE(opcode) \
diff --git a/a/content_digest b/N1/content_digest
index ccf8658..43ee46b 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -35,39 +35,39 @@
[
"From: Stephen Kitt\n",
"> Sent: 09 March 2018 22:34\n",
- ">=20\n",
+ "> \n",
"> COMMAND_SIZE currently uses an array of values in block/scsi_ioctl.c.\n",
"> A number of device_handler functions use this to initialise arrays,\n",
"> and this is flagged by -Wvla.\n",
- ">=20\n",
+ "> \n",
"> This patch replaces COMMAND_SIZE with a variant using a formula which\n",
"> can be resolved at compile time in cases where the opcode is fixed,\n",
"> resolving the array size and avoiding the VLA. The downside is that\n",
"> the code is less maintainable and that some call sites end up having\n",
"> more complex generated code.\n",
- ">=20\n",
+ "> \n",
"> Since scsi_command_size_tbl is dropped, we can remove the dependency\n",
"> on BLK_SCSI_REQUEST from drivers/target/Kconfig.\n",
- ">=20\n",
+ "> \n",
"> This was prompted by https://lkml.org/lkml/2018/3/7/621\n",
- ">=20\n",
+ "> \n",
"> Signed-off-by: Stephen Kitt <steve\@sk2.org>\n",
"> ---\n",
"> block/scsi_ioctl.c | 8 --------\n",
"> drivers/target/Kconfig | 1 -\n",
"> include/scsi/scsi_common.h | 13 +++++++++++--\n",
"> 3 files changed, 11 insertions(+), 11 deletions(-)\n",
- ">=20\n",
+ "> \n",
"> diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c\n",
"> index 60b471f8621b..b9e176e537be 100644\n",
"> --- a/block/scsi_ioctl.c\n",
"> +++ b/block/scsi_ioctl.c\n",
"> \@\@ -41,14 +41,6 \@\@ struct blk_cmd_filter {\n",
- ">=20\n",
+ "> \n",
"> static struct blk_cmd_filter blk_default_cmd_filter;\n",
- ">=20\n",
+ "> \n",
"> -/* Command group 3 is reserved and should never be used. */\n",
- "> -const unsigned char scsi_command_size_tbl[8] =3D\n",
+ "> -const unsigned char scsi_command_size_tbl[8] =\n",
"> -{\n",
"> -\t6, 10, 10, 12,\n",
"> -\t16, 12, 10, 10\n",
@@ -75,7 +75,7 @@
"> -EXPORT_SYMBOL(scsi_command_size_tbl);\n",
"> -\n",
"> #include <scsi/sg.h>\n",
- ">=20\n",
+ "> \n",
"> static int sg_get_version(int __user *p)\n",
"> diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig\n",
"> index 4c44d7bed01a..b5f05b60cf06 100644\n",
@@ -96,19 +96,16 @@
"> \@\@ -15,8 +15,17 \@\@ scsi_varlen_cdb_length(const void *hdr)\n",
"> \treturn ((struct scsi_varlen_cdb_hdr *)hdr)->additional_cdb_length + 8;\n",
"> }\n",
- ">=20\n",
+ "> \n",
"> -extern const unsigned char scsi_command_size_tbl[8];\n",
"> -#define COMMAND_SIZE(opcode) scsi_command_size_tbl[((opcode) >> 5) & 7]\n",
"> +/*\n",
- "> + * SCSI command sizes are as follows, in bytes, for fixed size commands,=\n",
- " per\n",
+ "> + * SCSI command sizes are as follows, in bytes, for fixed size commands, per\n",
"> + * group: 6, 10, 10, 12, 16, 12, 10, 10. The top three bits of an opcode\n",
"> + * determine its group.\n",
- "> + * The size table is encoded into a 32-bit value by subtracting each val=\n",
- "ue\n",
+ "> + * The size table is encoded into a 32-bit value by subtracting each value\n",
"> + * from 16, resulting in a value of 1715488362\n",
- "> + * (6 << 28 + 6 << 24 + 4 << 20 + 0 << 16 + 4 << 12 + 6 << 8 + 6 << 4 + =\n",
- "10).\n",
+ "> + * (6 << 28 + 6 << 24 + 4 << 20 + 0 << 16 + 4 << 12 + 6 << 8 + 6 << 4 + 10).\n",
"> + * Command group 3 is reserved and should never be used.\n",
"> + */\n",
"> +#define COMMAND_SIZE(opcode) \\\n",
@@ -123,4 +120,4 @@
"\tDavid"
]
-13aa1b51fc172e54e0a5504b17e0a46dfd71d9db1971b6d3dbe644eb2775fcfa
+c877fd2cbd59b6041887b67ceabe6a68afbfecdb29df0b6f3f9994b120bc9b79
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.