Re: [PATCH 5/8] device: avoid format string in dev_set_name

From: Greg Kroah-Hartman
Date: Fri Jun 07 2013 - 19:11:05 EST


On Thu, Jun 06, 2013 at 01:52:22PM -0700, Kees Cook wrote:
> --- a/mm/backing-dev.c
> +++ b/mm/backing-dev.c
> @@ -515,7 +515,6 @@ EXPORT_SYMBOL(bdi_destroy);
> int bdi_setup_and_register(struct backing_dev_info *bdi, char *name,
> unsigned int cap)
> {
> - char tmp[32];
> int err;
>
> bdi->name = name;
> @@ -524,8 +523,8 @@ int bdi_setup_and_register(struct backing_dev_info *bdi, char *name,
> if (err)
> return err;
>
> - sprintf(tmp, "%.28s%s", name, "-%d");
> - err = bdi_register(bdi, NULL, tmp, atomic_long_inc_return(&bdi_seq));
> + err = bdi_register(bdi, NULL, "%.28s-%d", name,
> + atomic_long_inc_return(&bdi_seq));
> if (err) {
> bdi_destroy(bdi);
> return err;

This chunk causes the following build warning to now show up:
mm/backing-dev.c: In function âbdi_setup_and_registerâ:
mm/backing-dev.c:527:7: warning: format â%dâ expects argument of type âintâ, but argument 5 has type âlong intâ [-Wformat]

Care to fix it up and resend it?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/