lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 23 Feb 2024 12:24:54 +0100
From: Sergio Paracuellos <sergio.paracuellos@...il.com>
To: linux-pci@...r.kernel.org
Cc: bhelgaas@...gle.com, lpieralisi@...nel.org, kw@...ux.com, robh@...nel.org, 
	matthias.bgg@...il.com, angelogioacchino.delregno@...labora.com, 
	linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org, 
	Bjorn Helgaas <helgaas@...nel.org>
Subject: Re: [PATCH] PCI: mt7621: Fix possible string truncation in snprintf

Hi,

On Thu, Jan 11, 2024 at 9:27 AM Sergio Paracuellos
<sergio.paracuellos@...il.com> wrote:
>
> The following warning appears when driver is compiled with W=1.
>
> CC      drivers/pci/controller/pcie-mt7621.o
> drivers/pci/controller/pcie-mt7621.c: In function ‘mt7621_pcie_probe’:
> drivers/pci/controller/pcie-mt7621.c:228:49: error: ‘snprintf’ output may
> be truncated before the last format character [-Werror=format-truncation=]
> 228 |         snprintf(name, sizeof(name), "pcie-phy%d", slot);
>     |                                                 ^
> drivers/pci/controller/pcie-mt7621.c:228:9: note: ‘snprintf’ output between
> 10 and 11 bytes into a destination of size 10
> 228 |         snprintf(name, sizeof(name), "pcie-phy%d", slot);
>     |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Clean this up increasing destination buffer one byte.
>
> Reported-by: Bjorn Helgaas <helgaas@...nel.org>
> Closes: https://lore.kernel.org/linux-pci/20240110212302.GA2123146@bhelgaas/T/#t
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@...il.com>
> ---
>  drivers/pci/controller/pcie-mt7621.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
> index 79e225edb42a..d97b956e6e57 100644
> --- a/drivers/pci/controller/pcie-mt7621.c
> +++ b/drivers/pci/controller/pcie-mt7621.c
> @@ -202,7 +202,7 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
>         struct mt7621_pcie_port *port;
>         struct device *dev = pcie->dev;
>         struct platform_device *pdev = to_platform_device(dev);
> -       char name[10];
> +       char name[11];
>         int err;
>
>         port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
> --
> 2.25.1
>

Gentle ping on this patch :)

Thanks,
    Sergio Paracuellos

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ