public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
Cc: Ben Dooks <ben-i2c-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] i2c-nomadik: fix regression on adapter name
Date: Mon, 29 Nov 2010 10:45:33 +0100	[thread overview]
Message-ID: <20101129104533.545b7953@endymion.delvare> (raw)
In-Reply-To: <1291023335-6430-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>

Hi Linus,

On Mon, 29 Nov 2010 10:35:35 +0100, Linus Walleij wrote:
> The Nomadik I2C adapter does not provide a name for the struct
> passed into i2c_add_numbered_adapter() causing a regression on
> 2.6.37-rc3 due to commit 2236baa75f704851d3cd3310569058151acb1f06
> adding sanity checks for adapters. Fix this by providing a name
> proper.

Thanks for the fix, but see below.

> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-nomadik.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
> index c9fffd0..f34a276 100644
> --- a/drivers/i2c/busses/i2c-nomadik.c
> +++ b/drivers/i2c/busses/i2c-nomadik.c
> @@ -872,6 +872,7 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
>  	adap->owner	= THIS_MODULE;
>  	adap->class	= I2C_CLASS_HWMON | I2C_CLASS_SPD;
>  	adap->algo	= &nmk_i2c_algo;
> +	strncpy(adap->name, DRIVER_NAME, sizeof(adap->name));

Please use strlcpy. strncpy is broken by design (result isn't
guaranteed to be NUL-terminated.)

Also, DRIVER_NAME ("nmk-i2c") is not a good adapter name. It's cryptic
and not unique if there is more than 1 such adapter on the system. I
would instead suggest something like:

	snprintf(adap->name, sizeof(adap->name), "Nomadik I2C at %lx\n",
		 (unsigned long)res->start);

>  
>  	/* fetch the controller id */
>  	adap->nr	= pdev->id;


-- 
Jean Delvare

  parent reply	other threads:[~2010-11-29  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29  9:35 [PATCH] i2c-nomadik: fix regression on adapter name Linus Walleij
     [not found] ` <1291023335-6430-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2010-11-29  9:45   ` Jean Delvare [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-11-30 15:59 Linus Walleij
     [not found] ` <1291132769-20775-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2010-11-30 16:03   ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101129104533.545b7953@endymion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=ben-i2c-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox