From: Sakari Ailus <sakari.ailus@iki.fi>
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-kernel@vger.kernel.org
Subject: Re: [PATCH v3] led/led-class: Handle LEDs with the same name
Date: Fri, 27 Mar 2015 01:30:25 +0200 [thread overview]
Message-ID: <20150326233025.GR18321@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <1426287939-7596-1-git-send-email-ricardo.ribalda@gmail.com>
Hi Ricardo,
On Sat, Mar 14, 2015 at 12:05:39AM +0100, Ricardo Ribalda Delgado wrote:
> @@ -219,12 +239,19 @@ static const struct dev_pm_ops leds_class_dev_pm_ops = {
> */
> int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
> {
> + char name[64];
> + int ret;
> +
> + ret = led_classdev_next_name(led_cdev->name, name, sizeof(name));
> led_cdev->dev = device_create_with_groups(leds_class, parent, 0,
> - led_cdev, led_cdev->groups,
> - "%s", led_cdev->name);
> + led_cdev, led_cdev->groups, name);
I just realised there was another issue --- the name is now interpreted as
format string. Bad things will happen if there's e.g. %s in the name itself
--- perhaps unlikely, but possible.
Now that I was about to submit a patch, I'll submit one for this one as
well. :-)
--
Regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
next prev parent reply other threads:[~2015-03-26 23:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 23:05 [PATCH v3] led/led-class: Handle LEDs with the same name Ricardo Ribalda Delgado
2015-03-25 0:54 ` Sakari Ailus
2015-03-25 9:20 ` Ricardo Ribalda Delgado
2015-03-25 13:02 ` Sakari Ailus
2015-03-25 13:22 ` Ricardo Ribalda Delgado
2015-03-25 13:53 ` Sakari Ailus
2015-03-25 18:33 ` Bryan Wu
2015-03-26 23:30 ` Sakari Ailus [this message]
2015-03-27 8:09 ` Ricardo Ribalda Delgado
2015-03-27 17:24 ` Bryan Wu
2015-03-28 1:07 ` Fengguang Wu
2015-06-08 22:55 ` Kees Cook
2015-06-26 9:19 ` Geert Uytterhoeven
2015-06-26 17:47 ` Kees Cook
2015-03-30 7:59 ` Geert Uytterhoeven
2015-03-30 8:35 ` Ricardo Ribalda Delgado
2015-03-30 8:43 ` Geert Uytterhoeven
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=20150326233025.GR18321@valkosipuli.retiisi.org.uk \
--to=sakari.ailus@iki.fi \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox