2011-03-08 04:00:27

by Vinay Sawal

[permalink] [raw]
Subject: [PATCH] FC: cifs: Initialized an uninitialized variable

Removed a compile time warning by initializing an uninitialized variable.

Signed-off-by: Vinay Sawal <[email protected]>
---
fs/cifs/file.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e964b1c..a9e5901 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1819,7 +1819,7 @@ static ssize_t
cifs_iovec_read(struct file *file, const struct iovec *iov,
unsigned long nr_segs, loff_t *poffset)
{
- int rc;
+ int rc = -EFAULT;
int xid;
ssize_t total_read;
unsigned int bytes_read = 0;
--
1.6.2.4


2011-03-08 04:26:07

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] FC: cifs: Initialized an uninitialized variable

On Mon, Mar 07, 2011 at 08:00:09PM -0800, Vinay Sawal wrote:
> Removed a compile time warning by initializing an uninitialized variable.

> - int rc;
> + int rc = -EFAULT;

Why is that the right thing to do? Other than "it made the compiler to
STFU, therefore it is Good(tm)", please.

2011-03-08 04:38:27

by Steve French

[permalink] [raw]
Subject: Re: [PATCH] FC: cifs: Initialized an uninitialized variable

On Mon, Mar 7, 2011 at 10:26 PM, Al Viro <[email protected]> wrote:
> On Mon, Mar 07, 2011 at 08:00:09PM -0800, Vinay Sawal wrote:
>> Removed a compile time warning by initializing an uninitialized variable.
>
>> - ? ? int rc;
>> + ? ? int rc = -EFAULT;
>
> Why is that the right thing to do? ?Other than "it made the compiler to
> STFU, therefore it is Good(tm)", please.

Hard to disagree with Al's logic, although changing the scope of rc to
within the for loop might also make both your compiler happy and more
sense. In any case, I prefer real bug fixes.


--
Thanks,

Steve

2011-03-08 04:48:53

by Vinay Sawal

[permalink] [raw]
Subject: Re: [PATCH] FC: cifs: Initialized an uninitialized variable

On Mon, Mar 7, 2011 at 8:38 PM, Steve French <[email protected]> wrote:
> On Mon, Mar 7, 2011 at 10:26 PM, Al Viro <[email protected]> wrote:
>> On Mon, Mar 07, 2011 at 08:00:09PM -0800, Vinay Sawal wrote:
>>> Removed a compile time warning by initializing an uninitialized variable.
>>
>>> - ? ? int rc;
>>> + ? ? int rc = -EFAULT;
>>
>> Why is that the right thing to do? ?Other than "it made the compiler to
>> STFU, therefore it is Good(tm)", please.
>
> Hard to disagree with Al's logic, although changing the scope of rc to
> within the for loop might also make both your compiler happy and more
> sense. ? In any case, I prefer real bug fixes.

Completely agree. Thanks for the clarification. Sorry for the inconvenience.

Thanks,
Vinay




>
>
> --
> Thanks,
>
> Steve
>