Patch "RDMA/IPoIB: Fix format truncation compilation errors" has been added to the 5.10-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    RDMA/IPoIB: Fix format truncation compilation errors

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-ipoib-fix-format-truncation-compilation-errors.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0d529d76557b88a901f8d5ed33123c4c4056ccd2
Author: Leon Romanovsky <leon@xxxxxxxxxx>
Date:   Thu May 9 10:39:33 2024 +0300

    RDMA/IPoIB: Fix format truncation compilation errors
    
    [ Upstream commit 49ca2b2ef3d003402584c68ae7b3055ba72e750a ]
    
    Truncate the device name to store IPoIB VLAN name.
    
    [leonro@5b4e8fba4ddd kernel]$ make -s -j 20 allmodconfig
    [leonro@5b4e8fba4ddd kernel]$ make -s -j 20 W=1 drivers/infiniband/ulp/ipoib/
    drivers/infiniband/ulp/ipoib/ipoib_vlan.c: In function ‘ipoib_vlan_add’:
    drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:52: error: ‘%04x’
    directive output may be truncated writing 4 bytes into a region of size
    between 0 and 15 [-Werror=format-truncation=]
      187 |         snprintf(intf_name, sizeof(intf_name), "%s.%04x",
          |                                                    ^~~~
    drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:48: note: directive
    argument in the range [0, 65535]
      187 |         snprintf(intf_name, sizeof(intf_name), "%s.%04x",
          |                                                ^~~~~~~~~
    drivers/infiniband/ulp/ipoib/ipoib_vlan.c:187:9: note: ‘snprintf’ output
    between 6 and 21 bytes into a destination of size 16
      187 |         snprintf(intf_name, sizeof(intf_name), "%s.%04x",
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      188 |                  ppriv->dev->name, pkey);
          |                  ~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[6]: *** [scripts/Makefile.build:244: drivers/infiniband/ulp/ipoib/ipoib_vlan.o] Error 1
    make[6]: *** Waiting for unfinished jobs....
    
    Fixes: 9baa0b036410 ("IB/ipoib: Add rtnl_link_ops support")
    Link: https://lore.kernel.org/r/e9d3e1fef69df4c9beaf402cc3ac342bad680791.1715240029.git.leon@xxxxxxxxxx
    Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
index 4c50a87ed7cc2..15a7cda44676c 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
@@ -185,8 +185,12 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
 
 	ppriv = ipoib_priv(pdev);
 
-	snprintf(intf_name, sizeof(intf_name), "%s.%04x",
-		 ppriv->dev->name, pkey);
+	/* If you increase IFNAMSIZ, update snprintf below
+	 * to allow longer names.
+	 */
+	BUILD_BUG_ON(IFNAMSIZ != 16);
+	snprintf(intf_name, sizeof(intf_name), "%.10s.%04x", ppriv->dev->name,
+		 pkey);
 
 	ndev = ipoib_intf_alloc(ppriv->ca, ppriv->port, intf_name);
 	if (IS_ERR(ndev)) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux