public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Poyo VL <poyo_vl@yahoo.com>
To: kernel-janitors@vger.kernel.org
Subject: Fw: [PATCH] drivers/block/cciss.c (2.6.34.7): Fixed useless compile warning
Date: Tue, 21 Sep 2010 09:48:12 +0000	[thread overview]
Message-ID: <481583.87768.qm@web45807.mail.sp1.yahoo.com> (raw)

GCC version: gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE 
Linux) 

And I'm sorry, the kernel version is 2.6.34.7 not 2.6.35.7.
But I selected almost all options from "make menuconfig", I think this is 
important to mention.
All warnings are like this one
drivers/block/cciss.c: In function ‘dev_show_unique_id’:
drivers/block/cciss.c:564:7: warning: ‘sn[0]’ may be used uninitialized in this 
function
I tried to explain. The sn[] array is initialized here: else memcpy(sn, 
drv->serial_no, sizeof(sn)); so it is initialized in a conditional expression, 
and is is used downer. So, the compiler think that it can be used unititialized 
and it throws that warning.
I fixed the patch, I am sorry, I'm a newbie.

Signed-off-by: Ionut Gabriel Popescu <poyo_vl@yahoo.com>
---

--- a/drivers/block/cciss.c    2010-09-17 20:17:49.844010958 +0300
+++ b/drivers/block/cciss.c    2010-09-13 19:54:58.000000000 +0300
@@ -561,7 +561,7 @@ static ssize_t dev_show_unique_id(struct
 {
     drive_info_struct *drv = to_drv(dev);
     struct ctlr_info *h = to_hba(drv->dev.parent);
-    __u8 sn[16];
+    __u8 sn[16] = {0};
     unsigned long flags;
     int ret = 0;




----- Forwarded Message ----
From: Dan Carpenter <error27@gmail.com>
To: Poyo VL <poyo_vl@yahoo.com>
Cc: kernel-janitors@vger.kernel.org
Sent: Tue, September 21, 2010 10:05:59 AM
Subject: Re: [PATCH] drivers/block/cciss.c (2.6.35.7): Fixed useless compile 
warning


Which version of gcc are you using?  It doesn't print any error message
for me on version 4.3.2 (which is really old).

The idea is fine but the patch is all messed up.  First of all the it's
reversed.  It says '+' where it should say '-' and '-' where it should
say '+'.

Also your mail client has completely mangled it.  It has removed spaces
from the start of lines and changed the tabs to spaces.  Please read
Documentation/email-clients.txt and send an email to yourself.  Save the
email as raw text.  cat email.txt | patch -p1.

When that works resend it.  Add these people to the CC list:

Mike Miller <mike.miller@hp.com>
Jens Axboe <jaxboe@fusionio.com>
"Stephen M. Cameron" <scameron@beardog.cce.hp.com>
iss_storagedev@hp.com

Also you don't need to copy all 16 lines of error messages.  Just a
couple will do.  But do say which version of gcc you are using.

regards,
dan carpenter


      

             reply	other threads:[~2010-09-21  9:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21  9:48 Poyo VL [this message]
2010-09-21 10:31 ` Fw: [PATCH] drivers/block/cciss.c (2.6.34.7): Fixed useless Dan Carpenter
2010-09-21 15:55 ` [PATCH] drivers/block/cciss.c (2.6.34.7): Fixed useless compile Miller, Mike (OS Dev)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=481583.87768.qm@web45807.mail.sp1.yahoo.com \
    --to=poyo_vl@yahoo.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox