All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
	"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] leds/class: Check snprintf return value
Date: Mon, 30 Mar 2015 10:59:00 +0200	[thread overview]
Message-ID: <CAMuHMdXdtWvMazm12Kr3TGf=gWjMqqTaCr-t6W7yQscveVeTrA@mail.gmail.com> (raw)
In-Reply-To: <1427705712-18083-3-git-send-email-ricardo.ribalda@gmail.com>

On Mon, Mar 30, 2015 at 10:55 AM, Ricardo Ribalda Delgado
<ricardo.ribalda@gmail.com> wrote:
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -223,12 +223,17 @@ static int led_classdev_next_name(const char *init_name, char *name,
>                                   size_t len)
>  {
>         int i = 0;
> +       int ret = 0;
>
>         strlcpy(name, init_name, len);
>
> -       while (class_find_device(leds_class, NULL, name, match_name))
> +       while (class_find_device(leds_class, NULL, name, match_name) &&
> +              (ret < len))
>                 snprintf(name, len, "%s_%d", init_name, ++i);

Missing "ret = "

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2015-03-30  8:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30  8:55 [PATCH 0/3] leds/class: Fix string handling Ricardo Ribalda Delgado
2015-03-30  8:55 ` [PATCH 1/3] leds/class: Use strlcpy instead of strncpy Ricardo Ribalda Delgado
2015-03-30  8:55 ` [PATCH 2/3] leds/class: Check snprintf return value Ricardo Ribalda Delgado
2015-03-30  8:59   ` Geert Uytterhoeven [this message]
2015-03-30  8:55 ` [PATCH 3/3] leds/class: Set naming index as unsigned Ricardo Ribalda Delgado
2015-03-30  8:59   ` Geert Uytterhoeven
2015-03-30 17:15 ` [PATCH 0/3] leds/class: Fix string handling Bryan Wu
2015-03-30 17:46   ` Ricardo Ribalda Delgado
2015-03-30 18:11     ` Bryan Wu
2015-03-30  9:08 [PATCH 2/3] leds/class: Check snprintf return value Ricardo Ribalda Delgado
2015-03-30  9:08 Ricardo Ribalda Delgado
2015-07-24  3:17 ` Alan Tull

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='CAMuHMdXdtWvMazm12Kr3TGf=gWjMqqTaCr-t6W7yQscveVeTrA@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=cooloney@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=ricardo.ribalda@gmail.com \
    --cc=rpurdie@rpsys.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.