* [PATCH] checkpatch: Fix use of uninitialized value
@ 2021-04-08 6:51 Greg Kurz
2021-04-08 17:49 ` Isaku Yamahata
2021-04-09 15:08 ` Alex Bennée
0 siblings, 2 replies; 5+ messages in thread
From: Greg Kurz @ 2021-04-08 6:51 UTC (permalink / raw)
To: qemu-devel; +Cc: isaku.yamahata, Peter Maydell, Michael S. Tsirkin
checkfilename() doesn't always set $acpi_testexpected. Fix the following
warning:
Use of uninitialized value $acpi_testexpected in string eq at
./scripts/checkpatch.pl line 1529.
Fixes: d2f1af0e4120 ("checkpatch: don't emit warning on newly created acpi data files")
Cc: isaku.yamahata@intel.com
Signed-off-by: Greg Kurz <groug@kaod.org>
---
scripts/checkpatch.pl | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8f7053ec9b26..3d185cceac94 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1532,6 +1532,7 @@ sub process {
($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
(defined($1) || defined($2)))) &&
!(($realfile ne '') &&
+ defined($acpi_testexpected) &&
($realfile eq $acpi_testexpected))) {
$reported_maintainer_file = 1;
WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: Fix use of uninitialized value
2021-04-08 6:51 [PATCH] checkpatch: Fix use of uninitialized value Greg Kurz
@ 2021-04-08 17:49 ` Isaku Yamahata
2021-04-09 5:40 ` Greg Kurz
2021-04-09 15:08 ` Alex Bennée
1 sibling, 1 reply; 5+ messages in thread
From: Isaku Yamahata @ 2021-04-08 17:49 UTC (permalink / raw)
To: Greg Kurz
Cc: isaku.yamahata, Peter Maydell, qemu-devel, isaku.yamahata,
Michael S. Tsirkin
How about initializing them explicitly as follows?
($realfile ne '') prevents the case realfile eq '' && acpi_testexpted eq ''.
Anyway your patch also should fix it. So
Reviewed-by: Isaku Yamahata <isaku.yamahata@intel.com>
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8f7053ec9b..2eb894a628 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1325,8 +1325,8 @@ sub process {
my %suppress_whiletrailers;
my %suppress_export;
- my $acpi_testexpected;
- my $acpi_nontestexpected;
+ my $acpi_testexpected = '';
+ my $acpi_nontestexpected = '';
# Pre-scan the patch sanitizing the lines.
On Thu, Apr 08, 2021 at 08:51:19AM +0200,
Greg Kurz <groug@kaod.org> wrote:
> checkfilename() doesn't always set $acpi_testexpected. Fix the following
> warning:
>
> Use of uninitialized value $acpi_testexpected in string eq at
> ./scripts/checkpatch.pl line 1529.
>
> Fixes: d2f1af0e4120 ("checkpatch: don't emit warning on newly created acpi data files")
> Cc: isaku.yamahata@intel.com
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> scripts/checkpatch.pl | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 8f7053ec9b26..3d185cceac94 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1532,6 +1532,7 @@ sub process {
> ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
> (defined($1) || defined($2)))) &&
> !(($realfile ne '') &&
> + defined($acpi_testexpected) &&
> ($realfile eq $acpi_testexpected))) {
> $reported_maintainer_file = 1;
> WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
>
>
>
--
Isaku Yamahata <isaku.yamahata@gmail.com>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: Fix use of uninitialized value
2021-04-08 17:49 ` Isaku Yamahata
@ 2021-04-09 5:40 ` Greg Kurz
2021-04-09 17:55 ` Isaku Yamahata
0 siblings, 1 reply; 5+ messages in thread
From: Greg Kurz @ 2021-04-09 5:40 UTC (permalink / raw)
To: Isaku Yamahata
Cc: isaku.yamahata, Peter Maydell, qemu-devel, Michael S. Tsirkin
On Thu, 8 Apr 2021 10:49:13 -0700
Isaku Yamahata <isaku.yamahata@gmail.com> wrote:
>
> How about initializing them explicitly as follows?
> ($realfile ne '') prevents the case realfile eq '' && acpi_testexpted eq ''.
> Anyway your patch also should fix it. So
> Reviewed-by: Isaku Yamahata <isaku.yamahata@intel.com>
>
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 8f7053ec9b..2eb894a628 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1325,8 +1325,8 @@ sub process {
> my %suppress_whiletrailers;
> my %suppress_export;
>
> - my $acpi_testexpected;
> - my $acpi_nontestexpected;
> + my $acpi_testexpected = '';
> + my $acpi_nontestexpected = '';
>
Hmm... I haven't tried but I believe this will break when these are
passed to checkfilename() :
sub checkfilename {
my ($name, $acpi_testexpected, $acpi_nontestexpected) = @_;
[...]
if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {
ERROR("Do not add expected files together with tests, " .
> # Pre-scan the patch sanitizing the lines.
>
>
> On Thu, Apr 08, 2021 at 08:51:19AM +0200,
> Greg Kurz <groug@kaod.org> wrote:
>
> > checkfilename() doesn't always set $acpi_testexpected. Fix the following
> > warning:
> >
> > Use of uninitialized value $acpi_testexpected in string eq at
> > ./scripts/checkpatch.pl line 1529.
> >
> > Fixes: d2f1af0e4120 ("checkpatch: don't emit warning on newly created acpi data files")
> > Cc: isaku.yamahata@intel.com
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> > scripts/checkpatch.pl | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 8f7053ec9b26..3d185cceac94 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -1532,6 +1532,7 @@ sub process {
> > ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
> > (defined($1) || defined($2)))) &&
> > !(($realfile ne '') &&
> > + defined($acpi_testexpected) &&
> > ($realfile eq $acpi_testexpected))) {
> > $reported_maintainer_file = 1;
> > WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
> >
> >
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: Fix use of uninitialized value
2021-04-08 6:51 [PATCH] checkpatch: Fix use of uninitialized value Greg Kurz
2021-04-08 17:49 ` Isaku Yamahata
@ 2021-04-09 15:08 ` Alex Bennée
1 sibling, 0 replies; 5+ messages in thread
From: Alex Bennée @ 2021-04-09 15:08 UTC (permalink / raw)
To: Greg Kurz; +Cc: isaku.yamahata, Peter Maydell, qemu-devel, Michael S. Tsirkin
Greg Kurz <groug@kaod.org> writes:
> checkfilename() doesn't always set $acpi_testexpected. Fix the following
> warning:
>
> Use of uninitialized value $acpi_testexpected in string eq at
> ./scripts/checkpatch.pl line 1529.
>
> Fixes: d2f1af0e4120 ("checkpatch: don't emit warning on newly created acpi data files")
> Cc: isaku.yamahata@intel.com
> Signed-off-by: Greg Kurz <groug@kaod.org>
jinx ;-)
Subject: [RFC PATCH] scripts/checkpatch: fix uninitialised value check
Date: Thu, 8 Apr 2021 17:46:10 +0100
Message-Id: <20210408164610.14229-1-alex.bennee@linaro.org>
but as I failed to check the list first have a:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> scripts/checkpatch.pl | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 8f7053ec9b26..3d185cceac94 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1532,6 +1532,7 @@ sub process {
> ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
> (defined($1) || defined($2)))) &&
> !(($realfile ne '') &&
> + defined($acpi_testexpected) &&
> ($realfile eq $acpi_testexpected))) {
> $reported_maintainer_file = 1;
> WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
--
Alex Bennée
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: Fix use of uninitialized value
2021-04-09 5:40 ` Greg Kurz
@ 2021-04-09 17:55 ` Isaku Yamahata
0 siblings, 0 replies; 5+ messages in thread
From: Isaku Yamahata @ 2021-04-09 17:55 UTC (permalink / raw)
To: Greg Kurz
Cc: isaku.yamahata, Peter Maydell, qemu-devel, Isaku Yamahata,
Michael S. Tsirkin
On Fri, Apr 09, 2021 at 07:40:11AM +0200,
Greg Kurz <groug@kaod.org> wrote:
> On Thu, 8 Apr 2021 10:49:13 -0700
> Isaku Yamahata <isaku.yamahata@gmail.com> wrote:
>
> >
> > How about initializing them explicitly as follows?
> > ($realfile ne '') prevents the case realfile eq '' && acpi_testexpted eq ''.
> > Anyway your patch also should fix it. So
> > Reviewed-by: Isaku Yamahata <isaku.yamahata@intel.com>
> >
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 8f7053ec9b..2eb894a628 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -1325,8 +1325,8 @@ sub process {
> > my %suppress_whiletrailers;
> > my %suppress_export;
> >
> > - my $acpi_testexpected;
> > - my $acpi_nontestexpected;
> > + my $acpi_testexpected = '';
> > + my $acpi_nontestexpected = '';
> >
>
> Hmm... I haven't tried but I believe this will break when these are
> passed to checkfilename() :
>
> sub checkfilename {
> my ($name, $acpi_testexpected, $acpi_nontestexpected) = @_;
> [...]
> if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {
> ERROR("Do not add expected files together with tests, " .
>
>
> > # Pre-scan the patch sanitizing the lines.
Oops. You're right. I scratch it.
--
Isaku Yamahata <isaku.yamahata@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-04-09 17:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 6:51 [PATCH] checkpatch: Fix use of uninitialized value Greg Kurz
2021-04-08 17:49 ` Isaku Yamahata
2021-04-09 5:40 ` Greg Kurz
2021-04-09 17:55 ` Isaku Yamahata
2021-04-09 15:08 ` Alex Bennée
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).