Re: [patch] checkpatch: warn on missing spaces in broken up quoted strings

From: Dan Carpenter
Date: Fri Jun 13 2014 - 05:47:07 EST


On Fri, Jun 13, 2014 at 02:30:22AM -0700, Joe Perches wrote:

> > +# check for missing a space in a string concatination
> > + if ($prevrawline =~ /[^\\][a-zA-Z]"$/ && $rawline =~ /^\+[\t ]+"[a-zA-Z]/) {
> > + WARN('MISSING_SPACE',
> > + "break quoted strings at a space character\n" . $hereprev);
> > + }
>
> Probably want digits too so maybe \w instead of "[a-zA-Z]/
>

Changing it to that adds the following 6 new warnings:

./drivers/staging/media/lirc/lirc_zilog.c:806 "1) -- please upgrade to a newer driver",
- bug.

./drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:529 "24G_A[%d] = 0x%x\n", i,
./drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:537 "24G_C[%d] = 0x%x\n", i,
- the "24G_A" is the last 5 characters of a variable name so
this is sloppy code.

./drivers/scsi/pm8001/pm8001_ctl.c:297 "0x%08x 0x%08x\n",
./drivers/scsi/pm8001/pm8001_ctl.c:432 "0x%08x 0x%08x\n",
./drivers/scsi/qla2xxx/qla_nx2.c:1457 "0x%X 0x%X 0x%X 0x%X 0x%X 0x%X\n"
- hex false positives

I thought about doing that when I wrote my original patch but I was
worried about more hex false positives. If there are only those 3 then
it's probably not a big deal. What do you think?

regards,
dan carpenter

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