* [PATCH 1/6] f2fs: fix the compiler warning for uninitialized use of variable
@ 2012-12-01 1:55 Namjae Jeon
2012-12-02 22:56 ` Jaegeuk Kim
0 siblings, 1 reply; 2+ messages in thread
From: Namjae Jeon @ 2012-12-01 1:55 UTC (permalink / raw)
To: jaegeuk.kim
Cc: linux-fsdevel, linux-kernel, Namjae Jeon, Namjae Jeon,
Pankaj Kumar
From: Namjae Jeon <namjae.jeon@samsung.com>
When CONFIG_CC_OPTIMIZE_FOR_SIZE is enabled in the kernel, -Os optimisation
flag is passed to gcc for compilation, and somehow while trying to optimize
the code, compiler is might not able to see the initialisation of variable
ne struct variable inside the get_node_info() function and results into
following warning:
fs/f2fs/node.c: In function 'get_node_info':
fs/f2fs/node.c:175:3: warning: 'ne.block_addr' may be used uninitialized in
this function [-Wuninitialized]
fs/f2fs/node.c:265:24: note: 'ne.block_addr' was declared here
fs/f2fs/node.c:176:3: warning: 'ne.ino' may be used uninitialized in this
function [-Wuninitialized]
fs/f2fs/node.c:265:24: note: 'ne.ino' was declared here
fs/f2fs/node.c:177:3: warning: 'ne.version' may be used uninitialized in
this function [-Wuninitialized]
fs/f2fs/node.c:265:24: note: 'ne.version' was declared here
Hence, lets initialise the ne struct variable to zero, which will remove
this warning and also doing this does not seems to making any impact on the
code behavior.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
---
fs/f2fs/node.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 25d3036..1987036 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -266,6 +266,7 @@ void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni)
struct nat_entry *e;
int i;
+ memset(&ne, 0, sizeof(struct f2fs_nat_entry));
ni->nid = nid;
/* Check nat cache */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/6] f2fs: fix the compiler warning for uninitialized use of variable
2012-12-01 1:55 [PATCH 1/6] f2fs: fix the compiler warning for uninitialized use of variable Namjae Jeon
@ 2012-12-02 22:56 ` Jaegeuk Kim
0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2012-12-02 22:56 UTC (permalink / raw)
To: Namjae Jeon
Cc: linux-fsdevel, linux-kernel, Namjae Jeon, Pankaj Kumar,
linux-f2fs-devel
[-- Attachment #1: Type: text/plain, Size: 1913 bytes --]
Please, add CC: linux-f2fs-devel@lists.sourceforge.net
Thank you for contribution to f2fs.
Looks good, and I'll merge them.
Thanks,
2012-12-01 (토), 10:55 +0900, Namjae Jeon:
> From: Namjae Jeon <namjae.jeon@samsung.com>
>
> When CONFIG_CC_OPTIMIZE_FOR_SIZE is enabled in the kernel, -Os optimisation
> flag is passed to gcc for compilation, and somehow while trying to optimize
> the code, compiler is might not able to see the initialisation of variable
> ne struct variable inside the get_node_info() function and results into
> following warning:
>
> fs/f2fs/node.c: In function 'get_node_info':
> fs/f2fs/node.c:175:3: warning: 'ne.block_addr' may be used uninitialized in
> this function [-Wuninitialized]
> fs/f2fs/node.c:265:24: note: 'ne.block_addr' was declared here
> fs/f2fs/node.c:176:3: warning: 'ne.ino' may be used uninitialized in this
> function [-Wuninitialized]
> fs/f2fs/node.c:265:24: note: 'ne.ino' was declared here
> fs/f2fs/node.c:177:3: warning: 'ne.version' may be used uninitialized in
> this function [-Wuninitialized]
> fs/f2fs/node.c:265:24: note: 'ne.version' was declared here
>
> Hence, lets initialise the ne struct variable to zero, which will remove
> this warning and also doing this does not seems to making any impact on the
> code behavior.
>
> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
> Signed-off-by: Pankaj Kumar <pankaj.km@samsung.com>
> ---
> fs/f2fs/node.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> index 25d3036..1987036 100644
> --- a/fs/f2fs/node.c
> +++ b/fs/f2fs/node.c
> @@ -266,6 +266,7 @@ void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni)
> struct nat_entry *e;
> int i;
>
> + memset(&ne, 0, sizeof(struct f2fs_nat_entry));
> ni->nid = nid;
>
> /* Check nat cache */
--
Jaegeuk Kim
Samsung
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-02 22:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-01 1:55 [PATCH 1/6] f2fs: fix the compiler warning for uninitialized use of variable Namjae Jeon
2012-12-02 22:56 ` Jaegeuk Kim
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).