Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe()
@ 2025-01-23 10:31 Niklas Cassel
  2025-01-23 16:00 ` Frank Li
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Niklas Cassel @ 2025-01-23 10:31 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Niklas Cassel, linux-pci

Increase the size of the string buffer to avoid potential truncation in
pci_endpoint_test_probe().

This fixes the following build warning when compiling with W=1:

drivers/misc/pci_endpoint_test.c:29:49: note: directive argument in the range [0, 2147483647]
   29 | #define DRV_MODULE_NAME                         "pci-endpoint-test"
      |                                                 ^~~~~~~~~~~~~~~~~~~
drivers/misc/pci_endpoint_test.c:998:38: note: in expansion of macro ‘DRV_MODULE_NAME’
  998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
      |                                      ^~~~~~~~~~~~~~~
drivers/misc/pci_endpoint_test.c:998:9: note: ‘snprintf’ output between 20 and 29 bytes into a destination of size 24
  998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/misc/pci_endpoint_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 8e48a15100f1..b0db94161d31 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -912,7 +912,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 {
 	int ret;
 	int id;
-	char name[24];
+	char name[29];
 	enum pci_barno bar;
 	void __iomem *base;
 	struct device *dev = &pdev->dev;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe()
  2025-01-23 10:31 [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe() Niklas Cassel
@ 2025-01-23 16:00 ` Frank Li
  2025-02-01 15:47 ` Manivannan Sadhasivam
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2025-01-23 16:00 UTC (permalink / raw)
  To: Niklas Cassel
  Cc: Manivannan Sadhasivam, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Arnd Bergmann, Greg Kroah-Hartman,
	linux-pci

On Thu, Jan 23, 2025 at 11:31:28AM +0100, Niklas Cassel wrote:
> Increase the size of the string buffer to avoid potential truncation in
> pci_endpoint_test_probe().
>
> This fixes the following build warning when compiling with W=1:
>
> drivers/misc/pci_endpoint_test.c:29:49: note: directive argument in the range [0, 2147483647]
>    29 | #define DRV_MODULE_NAME                         "pci-endpoint-test"
>       |                                                 ^~~~~~~~~~~~~~~~~~~
> drivers/misc/pci_endpoint_test.c:998:38: note: in expansion of macro ‘DRV_MODULE_NAME’
>   998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
>       |                                      ^~~~~~~~~~~~~~~
> drivers/misc/pci_endpoint_test.c:998:9: note: ‘snprintf’ output between 20 and 29 bytes into a destination of size 24
>   998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/misc/pci_endpoint_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index 8e48a15100f1..b0db94161d31 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -912,7 +912,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
>  {
>  	int ret;
>  	int id;
> -	char name[24];
> +	char name[29];
>  	enum pci_barno bar;
>  	void __iomem *base;
>  	struct device *dev = &pdev->dev;
> --
> 2.48.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe()
  2025-01-23 10:31 [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe() Niklas Cassel
  2025-01-23 16:00 ` Frank Li
@ 2025-02-01 15:47 ` Manivannan Sadhasivam
  2025-02-13 13:41 ` Niklas Cassel
  2025-02-14 17:42 ` Manivannan Sadhasivam
  3 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2025-02-01 15:47 UTC (permalink / raw)
  To: Niklas Cassel
  Cc: Krzysztof Wilczyński, Kishon Vijay Abraham I, Arnd Bergmann,
	Greg Kroah-Hartman, linux-pci

On Thu, Jan 23, 2025 at 11:31:28AM +0100, Niklas Cassel wrote:
> Increase the size of the string buffer to avoid potential truncation in
> pci_endpoint_test_probe().
> 
> This fixes the following build warning when compiling with W=1:
> 
> drivers/misc/pci_endpoint_test.c:29:49: note: directive argument in the range [0, 2147483647]
>    29 | #define DRV_MODULE_NAME                         "pci-endpoint-test"
>       |                                                 ^~~~~~~~~~~~~~~~~~~
> drivers/misc/pci_endpoint_test.c:998:38: note: in expansion of macro ‘DRV_MODULE_NAME’
>   998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
>       |                                      ^~~~~~~~~~~~~~~
> drivers/misc/pci_endpoint_test.c:998:9: note: ‘snprintf’ output between 20 and 29 bytes into a destination of size 24
>   998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Niklas Cassel <cassel@kernel.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

- Mani

> ---
>  drivers/misc/pci_endpoint_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index 8e48a15100f1..b0db94161d31 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -912,7 +912,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
>  {
>  	int ret;
>  	int id;
> -	char name[24];
> +	char name[29];
>  	enum pci_barno bar;
>  	void __iomem *base;
>  	struct device *dev = &pdev->dev;
> -- 
> 2.48.1
> 

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe()
  2025-01-23 10:31 [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe() Niklas Cassel
  2025-01-23 16:00 ` Frank Li
  2025-02-01 15:47 ` Manivannan Sadhasivam
@ 2025-02-13 13:41 ` Niklas Cassel
  2025-02-14 17:42 ` Manivannan Sadhasivam
  3 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2025-02-13 13:41 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-pci

On Thu, Jan 23, 2025 at 11:31:28AM +0100, Niklas Cassel wrote:
> Increase the size of the string buffer to avoid potential truncation in
> pci_endpoint_test_probe().
> 
> This fixes the following build warning when compiling with W=1:
> 
> drivers/misc/pci_endpoint_test.c:29:49: note: directive argument in the range [0, 2147483647]
>    29 | #define DRV_MODULE_NAME                         "pci-endpoint-test"
>       |                                                 ^~~~~~~~~~~~~~~~~~~
> drivers/misc/pci_endpoint_test.c:998:38: note: in expansion of macro ‘DRV_MODULE_NAME’
>   998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
>       |                                      ^~~~~~~~~~~~~~~
> drivers/misc/pci_endpoint_test.c:998:9: note: ‘snprintf’ output between 20 and 29 bytes into a destination of size 24
>   998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
>  drivers/misc/pci_endpoint_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index 8e48a15100f1..b0db94161d31 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -912,7 +912,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
>  {
>  	int ret;
>  	int id;
> -	char name[24];
> +	char name[29];
>  	enum pci_barno bar;
>  	void __iomem *base;
>  	struct device *dev = &pdev->dev;
> -- 
> 2.48.1
> 

Gentle ping.


Kind regards,
Niklas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe()
  2025-01-23 10:31 [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe() Niklas Cassel
                   ` (2 preceding siblings ...)
  2025-02-13 13:41 ` Niklas Cassel
@ 2025-02-14 17:42 ` Manivannan Sadhasivam
  3 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2025-02-14 17:42 UTC (permalink / raw)
  To: Niklas Cassel
  Cc: Krzysztof Wilczyński, Kishon Vijay Abraham I, Arnd Bergmann,
	Greg Kroah-Hartman, linux-pci

On Thu, Jan 23, 2025 at 11:31:28AM +0100, Niklas Cassel wrote:
> Increase the size of the string buffer to avoid potential truncation in
> pci_endpoint_test_probe().
> 
> This fixes the following build warning when compiling with W=1:
> 
> drivers/misc/pci_endpoint_test.c:29:49: note: directive argument in the range [0, 2147483647]
>    29 | #define DRV_MODULE_NAME                         "pci-endpoint-test"
>       |                                                 ^~~~~~~~~~~~~~~~~~~
> drivers/misc/pci_endpoint_test.c:998:38: note: in expansion of macro ‘DRV_MODULE_NAME’
>   998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
>       |                                      ^~~~~~~~~~~~~~~
> drivers/misc/pci_endpoint_test.c:998:9: note: ‘snprintf’ output between 20 and 29 bytes into a destination of size 24
>   998 |         snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Niklas Cassel <cassel@kernel.org>

Applied to pci/endpoint!

- Mani

> ---
>  drivers/misc/pci_endpoint_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
> index 8e48a15100f1..b0db94161d31 100644
> --- a/drivers/misc/pci_endpoint_test.c
> +++ b/drivers/misc/pci_endpoint_test.c
> @@ -912,7 +912,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
>  {
>  	int ret;
>  	int id;
> -	char name[24];
> +	char name[29];
>  	enum pci_barno bar;
>  	void __iomem *base;
>  	struct device *dev = &pdev->dev;
> -- 
> 2.48.1
> 

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-14 17:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-23 10:31 [PATCH] misc: pci_endpoint_test: Fix potential truncation in pci_endpoint_test_probe() Niklas Cassel
2025-01-23 16:00 ` Frank Li
2025-02-01 15:47 ` Manivannan Sadhasivam
2025-02-13 13:41 ` Niklas Cassel
2025-02-14 17:42 ` Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox