* [PATCH] i2c-stu300: make sure adapter-name is terminated
@ 2011-01-31 14:09 Wolfram Sang
[not found] ` <1296482963-27368-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2011-01-31 14:09 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Wolfram Sang, Linus Walleij, Ben Dooks
Use strlcpy instead of strncpy.
Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
---
Have been bitten by this, too. Thanks to Ben for spotting it in my driver.
This was the only occurence in i2c/busses.
drivers/i2c/busses/i2c-stu300.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 495be45..266135d 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -942,7 +942,7 @@ stu300_probe(struct platform_device *pdev)
adap->owner = THIS_MODULE;
/* DDC class but actually often used for more generic I2C */
adap->class = I2C_CLASS_DDC;
- strncpy(adap->name, "ST Microelectronics DDC I2C adapter",
+ strlcpy(adap->name, "ST Microelectronics DDC I2C adapter",
sizeof(adap->name));
adap->nr = bus_nr;
adap->algo = &stu300_algo;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c-stu300: make sure adapter-name is terminated
[not found] ` <1296482963-27368-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2011-01-31 14:26 ` Jean Delvare
0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2011-01-31 14:26 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Linus Walleij, Ben Dooks
On Mon, 31 Jan 2011 15:09:23 +0100, Wolfram Sang wrote:
> Use strlcpy instead of strncpy.
>
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
> Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Acked-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Ben, please apply.
> ---
>
> Have been bitten by this, too. Thanks to Ben for spotting it in my driver.
> This was the only occurence in i2c/busses.
I wish strncpy was removed from the kernel altogether.
>
> drivers/i2c/busses/i2c-stu300.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
> index 495be45..266135d 100644
> --- a/drivers/i2c/busses/i2c-stu300.c
> +++ b/drivers/i2c/busses/i2c-stu300.c
> @@ -942,7 +942,7 @@ stu300_probe(struct platform_device *pdev)
> adap->owner = THIS_MODULE;
> /* DDC class but actually often used for more generic I2C */
> adap->class = I2C_CLASS_DDC;
> - strncpy(adap->name, "ST Microelectronics DDC I2C adapter",
> + strlcpy(adap->name, "ST Microelectronics DDC I2C adapter",
> sizeof(adap->name));
> adap->nr = bus_nr;
> adap->algo = &stu300_algo;
--
Jean Delvare
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-31 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-31 14:09 [PATCH] i2c-stu300: make sure adapter-name is terminated Wolfram Sang
[not found] ` <1296482963-27368-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-01-31 14:26 ` Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).