Re: [PATCH] block: cmdline-parser: perfect cmdline format checking

From: Joe Perches
Date: Mon Nov 11 2013 - 19:45:58 EST


On Mon, 2013-11-11 at 15:34 -0800, Andrew Morton wrote:
> On Sat, 9 Nov 2013 11:45:14 +0000 Caizhiyong <caizhiyong@xxxxxxxxxxxxx> wrote:
[]
> > -perfect cmdline format checking, make the error information clear
> > for understand, make this lib fully equivalent to the old parser
> > in drivers/mtd/cmdlinepart.c
> >
> > ...
> >
> > +#define PARSER "cmdline-parser: "
> > ...
> > - pr_warn("cmdline partition size is invalid.");
> > + pr_warn(PARSER "partition '%s' size '0x%llx' too small.",
>
> You can use the standard pr_fmt() mechanism instead of this.
[]
> diff -puN block/cmdline-parser.c~mtd-cmdlinepart-use-cmdline-partition-parser-lib-fix block/cmdline-parser.c
[]
> @@ -21,10 +26,12 @@ static int parse_subpart(struct cmdline_
> if (*partdef == '-') {
> new_subpart->size = (sector_t)(~0ULL);
> partdef++;
> + lastpart = 1;
> } else {
> new_subpart->size = (sector_t)memparse(partdef, &partdef);
> if (new_subpart->size < (sector_t)PAGE_SIZE) {
> - pr_warn("cmdline partition size is invalid.");
> + pr_warn(PARSER "partition '%s' size '0x%llx' too small.",
> + partorg, new_subpart->size);

As well, please add terminating '\n' newlines to all the formats.
This helps avoid possible logging message interleaving.


--
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/