[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABJPP5CGCagfP1NTO5ci-wWNN9AOx2j-4i0Bj6G2mPXeja2jEg@mail.gmail.com>
Date: Sun, 25 Apr 2021 13:30:28 +0530
From: Dwaipayan Ray <dwaipayanray1@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Lukas Bulwahn <lukas.bulwahn@...il.com>
Subject: Re: [PATCH v2] checkpatch: fix uninitialized return value in raw_line subroutine
On Sun, Apr 25, 2021 at 1:14 PM Dwaipayan Ray <dwaipayanray1@...il.com> wrote:
>
> In case the second argument to raw_line subroutine is 0,
> $line remains uninitialized and is returned back to the caller.
> If the caller then tries to perform string concatenation with
> that value, checkpatch throws an error:
>
> Use of uninitialized value in concatenation (.) or string at
> ./scripts/checkpatch.pl line 1960.
>
> Fix it by providing an empty string as the initial value
> for $line.
>
Please ignore this patch. There was a different problem which
caused the error.
The following line triggers the errors:
DEVICE_ATTR(foo, 0777, foo_show, foo_store)
(notice the missing semicolon)
Perl throws the following errors when checkpatch is run on
a file containing that line:
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Setting $line to "" in raw_line fixed it. Probably -1 is being
sent as the second argument to raw_line which results
in the uninitialized thing.
Thanks,
Dwaipayan
Powered by blists - more mailing lists