mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Prevent use of unitialized variable
@ 2013-03-03 23:42 Fredrik Gustafsson
  2013-03-07  0:21 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Fredrik Gustafsson @ 2013-03-03 23:42 UTC (permalink / raw)
  To: apw; +Cc: iveqy, linux-kernel

Run checkpatch.pl -f kernel/fork.c in commit
ecf02a607bd801e742d7bb35c6e40f7ca15edf03
and checkpatch.pl will try to use an uninitialized variable.
This patch fixes that.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
---
 scripts/checkpatch.pl |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4d2c7df..4e34368 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3363,14 +3363,17 @@ sub process {
 
 			my $ms_addr = $2;
 			my $ms_val = $7;
-			my $ms_size = $12;
-
-			if ($ms_size =~ /^(0x|)0$/i) {
-				ERROR("MEMSET",
-				      "memset to 0's uses 0 as the 2nd argument, not the 3rd\n" . "$here\n$stat\n");
-			} elsif ($ms_size =~ /^(0x|)1$/i) {
-				WARN("MEMSET",
-				     "single byte memset is suspicious. Swapped 2nd/3rd argument?\n" . "$here\n$stat\n");
+
+			if (defined $12) {
+				my $ms_size = $12;
+
+				if ($ms_size =~ /^(0x|)0$/i) {
+					ERROR("MEMSET",
+						  "memset to 0's uses 0 as the 2nd argument, not the 3rd\n" . "$here\n$stat\n");
+				} elsif ($ms_size =~ /^(0x|)1$/i) {
+					WARN("MEMSET",
+						 "single byte memset is suspicious. Swapped 2nd/3rd argument?\n" . "$here\n$stat\n");
+				}
 			}
 		}
 
-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] Prevent use of unitialized variable
@ 2013-01-11  8:55 Fredrik Gustafsson
  0 siblings, 0 replies; 3+ messages in thread
From: Fredrik Gustafsson @ 2013-01-11  8:55 UTC (permalink / raw)
  To: apw; +Cc: linux-kernel, iveqy

Run checkpatch.pl -f kernel/fork.c in commit
ecf02a607bd801e742d7bb35c6e40f7ca15edf03
and checkpatch.pl will try to use an uninitialized variable.
This patch fixes that.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
---
 scripts/checkpatch.pl |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4d2c7df..4e34368 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3363,14 +3363,17 @@ sub process {
 
 			my $ms_addr = $2;
 			my $ms_val = $7;
-			my $ms_size = $12;
-
-			if ($ms_size =~ /^(0x|)0$/i) {
-				ERROR("MEMSET",
-				      "memset to 0's uses 0 as the 2nd argument, not the 3rd\n" . "$here\n$stat\n");
-			} elsif ($ms_size =~ /^(0x|)1$/i) {
-				WARN("MEMSET",
-				     "single byte memset is suspicious. Swapped 2nd/3rd argument?\n" . "$here\n$stat\n");
+
+			if (defined $12) {
+				my $ms_size = $12;
+
+				if ($ms_size =~ /^(0x|)0$/i) {
+					ERROR("MEMSET",
+						  "memset to 0's uses 0 as the 2nd argument, not the 3rd\n" . "$here\n$stat\n");
+				} elsif ($ms_size =~ /^(0x|)1$/i) {
+					WARN("MEMSET",
+						 "single byte memset is suspicious. Swapped 2nd/3rd argument?\n" . "$here\n$stat\n");
+				}
 			}
 		}
 
-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-07  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-03 23:42 [PATCH] Prevent use of unitialized variable Fredrik Gustafsson
2013-03-07  0:21 ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2013-01-11  8:55 Fredrik Gustafsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®