Patch "ata: libata-core: Fix compilation warning in ata_dev_config_ncq()" has been added to the 6.5-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

    ata: libata-core: Fix compilation warning in ata_dev_config_ncq()

to the 6.5-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:
     ata-libata-core-fix-compilation-warning-in-ata_dev_c.patch
and it can be found in the queue-6.5 subdirectory.

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



commit ce942b70117d945d169645c1b503f9921e48e8df
Author: Damien Le Moal <dlemoal@xxxxxxxxxx>
Date:   Tue Sep 12 08:46:22 2023 +0900

    ata: libata-core: Fix compilation warning in ata_dev_config_ncq()
    
    [ Upstream commit ed518d9ba980dc0d27c7d1dea1e627ba001d1977 ]
    
    The 24 bytes length allocated to the ncq_desc string in
    ata_dev_config_lba() for ata_dev_config_ncq() to use is too short,
    causing the following gcc compilation warnings when compiling with W=1:
    
    drivers/ata/libata-core.c: In function ‘ata_dev_configure’:
    drivers/ata/libata-core.c:2378:56: warning: ‘%d’ directive output may be truncated writing between 1 and 2 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
     2378 |                 snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
          |                                                        ^~
    In function ‘ata_dev_config_ncq’,
        inlined from ‘ata_dev_config_lba’ at drivers/ata/libata-core.c:2649:8,
        inlined from ‘ata_dev_configure’ at drivers/ata/libata-core.c:2952:9:
    drivers/ata/libata-core.c:2378:41: note: directive argument in the range [1, 32]
     2378 |                 snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
          |                                         ^~~~~~~~~~~~~~~~~~~~~
    drivers/ata/libata-core.c:2378:17: note: ‘snprintf’ output between 16 and 31 bytes into a destination of size 24
     2378 |                 snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     2379 |                         ddepth, aa_desc);
          |                         ~~~~~~~~~~~~~~~~
    
    Avoid these warnings and the potential truncation by changing the size
    of the ncq_desc string to 32 characters.
    
    Signed-off-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
    Reviewed-by: Hannes Reinecke <hare@xxxxxxx>
    Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
    Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2a21f4d9500db..97a842b57a751 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2624,7 +2624,7 @@ static int ata_dev_config_lba(struct ata_device *dev)
 {
 	const u16 *id = dev->id;
 	const char *lba_desc;
-	char ncq_desc[24];
+	char ncq_desc[32];
 	int ret;
 
 	dev->flags |= ATA_DFLAG_LBA;



[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