* [PATCH] ubifs: Fix build warning
@ 2012-06-25 15:19 Alexandre Pereira da Silva
2012-06-25 16:15 ` Randy Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Pereira da Silva @ 2012-06-25 15:19 UTC (permalink / raw)
Cc: linux-kernel, linux-mtd, Adrian Hunter,
Alexandre Pereira da Silva, Artem Bityutskiy
Fix:
fs/ubifs/dir.c: In function 'ubifs_rename':
fs/ubifs/dir.c:972:15: warning: 'saved_nlink' may be used uninitialized
in this function
Initilize saved_nlink to 0
Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
---
fs/ubifs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index a6d42ef..d5b8cb1e 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -969,7 +969,7 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct ubifs_budget_req ino_req = { .dirtied_ino = 1,
.dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) };
struct timespec time;
- unsigned int saved_nlink;
+ unsigned int saved_nlink = 0;
/*
* Budget request settings: deletion direntry, new direntry, removing
--
1.7.10
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ubifs: Fix build warning
2012-06-25 15:19 [PATCH] ubifs: Fix build warning Alexandre Pereira da Silva
@ 2012-06-25 16:15 ` Randy Dunlap
2012-06-25 18:23 ` Alexandre Pereira da Silva
0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2012-06-25 16:15 UTC (permalink / raw)
To: Alexandre Pereira da Silva
Cc: linux-kernel, linux-mtd, Adrian Hunter, Artem Bityutskiy
On 06/25/2012 08:19 AM, Alexandre Pereira da Silva wrote:
> Fix:
> fs/ubifs/dir.c: In function 'ubifs_rename':
> fs/ubifs/dir.c:972:15: warning: 'saved_nlink' may be used uninitialized
> in this function
>
> Initilize saved_nlink to 0
Does nlink need to be init at all? is the warning bogus or valid?
If the warning is bogus, the preferred solution is:
#include <linux/compiler-gcc.h>
...
unsigned int uninitialized_var(nlink);
> Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
> ---
> fs/ubifs/dir.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
> index a6d42ef..d5b8cb1e 100644
> --- a/fs/ubifs/dir.c
> +++ b/fs/ubifs/dir.c
> @@ -969,7 +969,7 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
> struct ubifs_budget_req ino_req = { .dirtied_ino = 1,
> .dirtied_ino_d = ALIGN(old_inode_ui->data_len, 8) };
> struct timespec time;
> - unsigned int saved_nlink;
> + unsigned int saved_nlink = 0;
>
> /*
> * Budget request settings: deletion direntry, new direntry, removing
--
~Randy
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ubifs: Fix build warning
2012-06-25 16:15 ` Randy Dunlap
@ 2012-06-25 18:23 ` Alexandre Pereira da Silva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Pereira da Silva @ 2012-06-25 18:23 UTC (permalink / raw)
To: Randy Dunlap; +Cc: linux-kernel, linux-mtd, Adrian Hunter, Artem Bityutskiy
On Mon, Jun 25, 2012 at 1:15 PM, Randy Dunlap <rdunlap@xenotime.net> wrote:
> On 06/25/2012 08:19 AM, Alexandre Pereira da Silva wrote:
>
>> Fix:
>> fs/ubifs/dir.c: In function 'ubifs_rename':
>> fs/ubifs/dir.c:972:15: warning: 'saved_nlink' may be used uninitialized
>> in this function
>>
>> Initilize saved_nlink to 0
>
> Does nlink need to be init at all? is the warning bogus or valid?
>From the code, this is a bogus warning.
> If the warning is bogus, the preferred solution is:
>
> #include <linux/compiler-gcc.h>
> ...
> unsigned int uninitialized_var(nlink);
I will fix the patch as suggested. Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-25 18:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-25 15:19 [PATCH] ubifs: Fix build warning Alexandre Pereira da Silva
2012-06-25 16:15 ` Randy Dunlap
2012-06-25 18:23 ` Alexandre Pereira da Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox