<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/uapi/scsi, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-05-17T09:56:04+00:00</updated>
<entry>
<title>scsi: mpi3mr: Avoid memcpy field-spanning write WARNING</title>
<updated>2024-05-17T09:56:04+00:00</updated>
<author>
<name>Shin'ichiro Kawasaki</name>
<email>shinichiro.kawasaki@wdc.com</email>
</author>
<published>2024-03-23T08:41:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5f0266044dc611563539705bff0b3e1545fbb6aa'/>
<id>urn:sha1:5f0266044dc611563539705bff0b3e1545fbb6aa</id>
<content type='text'>
[ Upstream commit 429846b4b6ce9853e0d803a2357bb2e55083adf0 ]

When the "storcli2 show" command is executed for eHBA-9600, mpi3mr driver
prints this WARNING message:

  memcpy: detected field-spanning write (size 128) of single field "bsg_reply_buf-&gt;reply_buf" at drivers/scsi/mpi3mr/mpi3mr_app.c:1658 (size 1)
  WARNING: CPU: 0 PID: 12760 at drivers/scsi/mpi3mr/mpi3mr_app.c:1658 mpi3mr_bsg_request+0x6b12/0x7f10 [mpi3mr]

The cause of the WARN is 128 bytes memcpy to the 1 byte size array "__u8
replay_buf[1]" in the struct mpi3mr_bsg_in_reply_buf. The array is intended
to be a flexible length array, so the WARN is a false positive.

To suppress the WARN, remove the constant number '1' from the array
declaration and clarify that it has flexible length. Also, adjust the
memory allocation size to match the change.

Suggested-by: Sathya Prakash Veerichetty &lt;sathya.prakash@broadcom.com&gt;
Signed-off-by: Shin'ichiro Kawasaki &lt;shinichiro.kawasaki@wdc.com&gt;
Link: https://lore.kernel.org/r/20240323084155.166835-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: scsi_transport_fc: Adjust struct fc_nl_event flex array usage</title>
<updated>2022-09-25T16:52:48+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2022-09-21T20:51:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d88a0240ff76062eb0728963e7aacf6dbe87f7c7'/>
<id>urn:sha1:d88a0240ff76062eb0728963e7aacf6dbe87f7c7</id>
<content type='text'>
In order to help the compiler reason about the destination buffer in struct
fc_nl_event, add a flexible array member for this purpose.  However, since
the header is UAPI, it must not change size or layout, so a union is used.

The allocation size calculations are also corrected (it was potentially
allocating an extra 8 bytes), and the padding is zeroed to avoid leaking
kernel heap memory contents.

Detected at run-time by the recently added memcpy() bounds checking:

  memcpy: detected field-spanning write (size 8) of single field "&amp;event-&gt;event_data" at drivers/scsi/scsi_transport_fc.c:581 (size 4)

Link: https://lore.kernel.org/linux-next/42404B5E-198B-4FD3-94D6-5E16CF579EF3@linux.ibm.com/
Link: https://lore.kernel.org/r/20220921205155.1451649-1-keescook@chromium.org
Cc: "James E.J. Bottomley" &lt;jejb@linux.ibm.com&gt;
Cc: "Martin K. Petersen" &lt;martin.petersen@oracle.com&gt;
Cc: linux-scsi@vger.kernel.org
Reported-by: Sachin Sant &lt;sachinp@linux.ibm.com&gt;
Tested-by: Sachin Sant &lt;sachinp@linux.ibm.com&gt;
Reviewed-by: James Smart &lt;jsmart2021@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>treewide: uapi: Replace zero-length arrays with flexible-array members</title>
<updated>2022-06-28T19:26:05+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavoars@kernel.org</email>
</author>
<published>2022-04-07T00:36:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=94dfc73e7cf4a31da66b8843f0b9283ddd6b8381'/>
<id>urn:sha1:94dfc73e7cf4a31da66b8843f0b9283ddd6b8381</id>
<content type='text'>
There is a regular need in the kernel to provide a way to declare
having a dynamically sized set of trailing elements in a structure.
Kernel code should always use “flexible array members”[1] for these
cases. The older style of one-element or zero-length arrays should
no longer be used[2].

This code was transformed with the help of Coccinelle:
(linux-5.19-rc2$ spatch --jobs $(getconf _NPROCESSORS_ONLN) --sp-file script.cocci --include-headers --dir . &gt; output.patch)

@@
identifier S, member, array;
type T1, T2;
@@

struct S {
  ...
  T1 member;
  T2 array[
- 0
  ];
};

-fstrict-flex-arrays=3 is coming and we need to land these changes
to prevent issues like these in the short future:

../fs/minix/dir.c:337:3: warning: 'strcpy' will always overflow; destination buffer has size 0,
but the source string has length 2 (including NUL byte) [-Wfortify-source]
		strcpy(de3-&gt;name, ".");
		^

Since these are all [0] to [] changes, the risk to UAPI is nearly zero. If
this breaks anything, we can use a union with a new member name.

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/78
Build-tested-by: kernel test robot &lt;lkp@intel.com&gt;
Link: https://lore.kernel.org/lkml/62b675ec.wKX6AOZ6cbE71vtF%25lkp@intel.com/
Acked-by: Dan Williams &lt;dan.j.williams@intel.com&gt; # For ndctl.h
Signed-off-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
</content>
</entry>
<entry>
<title>scsi: mpi3mr: Add support for NVMe passthrough</title>
<updated>2022-05-02T21:02:42+00:00</updated>
<author>
<name>Sumit Saxena</name>
<email>sumit.saxena@broadcom.com</email>
</author>
<published>2022-04-29T21:16:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7dbd0dd8cde356d2a747d5c87dad7c2233dad8a4'/>
<id>urn:sha1:7dbd0dd8cde356d2a747d5c87dad7c2233dad8a4</id>
<content type='text'>
Add support for management applications to send an MPI3 Encapsulated NVMe
passthru command to the NVMe devices attached to an Avenger controller.
Since the NVMe drives are exposed as SCSI devices by the controller, the
standard NVMe applications cannot be used to interact with the drives and
the command sets supported are also limited by the controller firmware.
Special handling is required for MPI3 Encapsulated NVMe passthru commands
for PRP/SGL setup in the commands.

Link: https://lore.kernel.org/r/20220429211641.642010-8-sumit.saxena@broadcom.com
Reviewed-by: Himanshu Madhani &lt;himanshu.madhani@oracle.com&gt;
Signed-off-by: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: mpi3mr: Move data structures/definitions from MPI headers to uapi header</title>
<updated>2022-05-02T21:02:41+00:00</updated>
<author>
<name>Sumit Saxena</name>
<email>sumit.saxena@broadcom.com</email>
</author>
<published>2022-04-29T21:16:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f3de4706c1e0c3b9fa39ec24a30c1996a33bc9e4'/>
<id>urn:sha1:f3de4706c1e0c3b9fa39ec24a30c1996a33bc9e4</id>
<content type='text'>
This patch moves the data structures/definitions which are used by
userspace applications from MPI headers to uapi/scsi/scsi_bsg_mpi3mr.h

Link: https://lore.kernel.org/r/20220429211641.642010-4-sumit.saxena@broadcom.com
Reported by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Reviewed-by: Himanshu Madhani &lt;himanshu.madhani@oracle.com&gt;
Signed-off-by: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: mpi3mr: Add support for driver commands</title>
<updated>2022-05-02T21:02:41+00:00</updated>
<author>
<name>Sumit Saxena</name>
<email>sumit.saxena@broadcom.com</email>
</author>
<published>2022-04-29T21:16:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f5e6d5a343761081317c89d23489c93fbafc69ff'/>
<id>urn:sha1:f5e6d5a343761081317c89d23489c93fbafc69ff</id>
<content type='text'>
There are certain bsg commands which need to be completed by the driver
without involving firmware. These requests are termed driver commands. Add
support for these.

Link: https://lore.kernel.org/r/20220429211641.642010-3-sumit.saxena@broadcom.com
Reported by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Reviewed-by: Himanshu Madhani &lt;himanshu.madhani@oracle.com&gt;
Signed-off-by: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: fc: Add EDC ELS definition</title>
<updated>2021-08-25T02:56:33+00:00</updated>
<author>
<name>James Smart</name>
<email>jsmart2021@gmail.com</email>
</author>
<published>2021-08-16T16:28:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=54404d357284d1405d98c424951357d970f41168'/>
<id>urn:sha1:54404d357284d1405d98c424951357d970f41168</id>
<content type='text'>
Add Exchange Diagnostic Capabilities (EDC) ELS definition and the following
capability descriptors:

 - Link Fault Capability Descriptor

 - Congestion Signaling Capability Descriptor

Definitions taken from FC-LS-5 r5.01

Link: https://lore.kernel.org/r/20210816162901.121235-2-jsmart2021@gmail.com
Signed-off-by: James Smart &lt;jsmart2021@gmail.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: fc: Update formal FPIN descriptor definitions</title>
<updated>2020-10-26T22:06:45+00:00</updated>
<author>
<name>Shyam Sundar</name>
<email>ssundar@marvell.com</email>
</author>
<published>2020-10-21T09:27:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=874163aab75a6cd7422e71f1fbc6db12977fcf1d'/>
<id>urn:sha1:874163aab75a6cd7422e71f1fbc6db12977fcf1d</id>
<content type='text'>
Add Fabric Performance Impact Notification (FPIN) descriptor definitions
for the following FPINs:

 - Delivery Notification Descriptor

 - Peer Congestion Notification Descriptor

 - Congestion Notification Descriptor

Link: https://lore.kernel.org/r/20201021092715.22669-2-njavali@marvell.com
Reviewed-by: James Smart &lt;james.smart@broadcom.com&gt;
Reviewed-by: Himanshu Madhani &lt;himanshu.madhani@oracle.com&gt;
Signed-off-by: Shyam Sundar &lt;ssundar@marvell.com&gt;
Signed-off-by: Nilesh Javali &lt;njavali@marvell.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>scsi: qla2xxx: Change in PUREX to handle FPIN ELS requests</title>
<updated>2020-07-02T02:24:16+00:00</updated>
<author>
<name>Shyam Sundar</name>
<email>ssundar@marvell.com</email>
</author>
<published>2020-06-30T10:22:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=62e9dd177732843ae6c5b9d2ed61e7c9538fa276'/>
<id>urn:sha1:62e9dd177732843ae6c5b9d2ed61e7c9538fa276</id>
<content type='text'>
SAN Congestion Management generates ELS pkts whose size can vary and be &gt;
64 bytes. Change the PUREX handling code to support non-standard ELS pkt
size.

Link: https://lore.kernel.org/r/20200630102229.29660-2-njavali@marvell.com
Reviewed-by: Himanshu Madhani &lt;himanshu.madhani@oracle.com&gt;
Signed-off-by: Shyam Sundar &lt;ssundar@marvell.com&gt;
Signed-off-by: Arun Easi &lt;aeasi@marvell.com&gt;
Signed-off-by: Nilesh Javali &lt;njavali@marvell.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
</entry>
<entry>
<title>uapi: revert flexible-array conversions</title>
<updated>2020-05-04T16:30:15+00:00</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavo@embeddedor.com</email>
</author>
<published>2020-04-24T15:50:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1e6e9d0f4859ec698d55381ea26f4136eff3afe1'/>
<id>urn:sha1:1e6e9d0f4859ec698d55381ea26f4136eff3afe1</id>
<content type='text'>
These structures can get embedded in other structures in user-space
and cause all sorts of warnings and problems. So, we better don't take
any chances and keep the zero-length arrays in place for now.

Signed-off-by: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
</content>
</entry>
</feed>
