[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150326233025.GR18321@valkosipuli.retiisi.org.uk>
Date: Fri, 27 Mar 2015 01:30:25 +0200
From: Sakari Ailus <sakari.ailus@....fi>
To: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
Cc: Bryan Wu <cooloney@...il.com>, Richard Purdie <rpurdie@...ys.net>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] led/led-class: Handle LEDs with the same name
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@....fi XMPP: sailus@...iisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists