Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1647635 > unrolled thread
| Started by | Gang He <ghe@suse.com> |
|---|---|
| First post | 2017-05-23 07:20 +0200 |
| Last post | 2017-05-24 08:30 +0200 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH v2] ocfs2: fix a static checker warning Gang He <ghe@suse.com> - 2017-05-23 07:20 +0200
Re: [PATCH v2] ocfs2: fix a static checker warning Andrew Morton <akpm@linux-foundation.org> - 2017-05-24 00:40 +0200
Re: [PATCH v2] ocfs2: fix a static checker warning "Gang He" <ghe@suse.com> - 2017-05-24 04:10 +0200
Re: [Ocfs2-devel] [PATCH v2] ocfs2: fix a static checker warning Eric Ren <zren@suse.com> - 2017-05-24 08:30 +0200
| From | Gang He <ghe@suse.com> |
|---|---|
| Date | 2017-05-23 07:20 +0200 |
| Subject | [PATCH v2] ocfs2: fix a static checker warning |
| Message-ID | <tKaoF-7aM-1@gated-at.bofh.it> |
This patch will fix a static code checker warning, which looks
like below,
fs/ocfs2/inode.c:179 ocfs2_iget()
warn: passing zero to 'ERR_PTR'
this warning was caused by the
commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check").
after apply this patch, the error return value will not be NULL(zero).
Signed-off-by: Gang He <ghe@suse.com>
---
fs/ocfs2/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 382401d..1a1e007 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -136,7 +136,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno)
struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
int sysfile_type)
{
- int rc = 0;
+ int rc = -ESTALE;
struct inode *inode = NULL;
struct super_block *sb = osb->sb;
struct ocfs2_find_inode_args args;
--
1.8.5.6
[toc] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2017-05-24 00:40 +0200 |
| Message-ID | <tKqD7-1nw-13@gated-at.bofh.it> |
| In reply to | #1647635 |
On Tue, 23 May 2017 13:17:14 +0800 Gang He <ghe@suse.com> wrote:
> This patch will fix a static code checker warning, which looks
> like below,
> fs/ocfs2/inode.c:179 ocfs2_iget()
> warn: passing zero to 'ERR_PTR'
>
> this warning was caused by the
> commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check").
> after apply this patch, the error return value will not be NULL(zero).
>
> Signed-off-by: Gang He <ghe@suse.com>
> ---
> fs/ocfs2/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
> index 382401d..1a1e007 100644
> --- a/fs/ocfs2/inode.c
> +++ b/fs/ocfs2/inode.c
> @@ -136,7 +136,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno)
> struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
> int sysfile_type)
> {
> - int rc = 0;
> + int rc = -ESTALE;
> struct inode *inode = NULL;
> struct super_block *sb = osb->sb;
> struct ocfs2_find_inode_args args;
hm, OK, thanks. The resulting code still looks rather weird. Could
someone who works in this area please take a look?
[toc] | [prev] | [next] | [standalone]
| From | "Gang He" <ghe@suse.com> |
|---|---|
| Date | 2017-05-24 04:10 +0200 |
| Message-ID | <tKtUm-3Xk-9@gated-at.bofh.it> |
| In reply to | #1648975 |
Hello Andrew,
I am sorry that I did not write which static code checker tool, since I did not get the name from Dan, I think the tool should be like Coverity code checking tool.
Second, set the initial value of local variable rc to -ESTALE from zero, this change will make the code logic is strict consistent with before the commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check"), although it is very difficult to meet this problem in the real environment.
Thanks
Gang
>>>
> On Tue, 23 May 2017 13:17:14 +0800 Gang He <ghe@suse.com> wrote:
>
>> This patch will fix a static code checker warning, which looks
>> like below,
>> fs/ocfs2/inode.c:179 ocfs2_iget()
>> warn: passing zero to 'ERR_PTR'
>>
>> this warning was caused by the
>> commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check").
>> after apply this patch, the error return value will not be NULL(zero).
>>
>> Signed-off-by: Gang He <ghe@suse.com>
>> ---
>> fs/ocfs2/inode.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
>> index 382401d..1a1e007 100644
>> --- a/fs/ocfs2/inode.c
>> +++ b/fs/ocfs2/inode.c
>> @@ -136,7 +136,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64
> blkno)
>> struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned
> flags,
>> int sysfile_type)
>> {
>> - int rc = 0;
>> + int rc = -ESTALE;
>> struct inode *inode = NULL;
>> struct super_block *sb = osb->sb;
>> struct ocfs2_find_inode_args args;
>
> hm, OK, thanks. The resulting code still looks rather weird. Could
> someone who works in this area please take a look?
[toc] | [prev] | [next] | [standalone]
| From | Eric Ren <zren@suse.com> |
|---|---|
| Date | 2017-05-24 08:30 +0200 |
| Subject | Re: [Ocfs2-devel] [PATCH v2] ocfs2: fix a static checker warning |
| Message-ID | <tKxXY-71C-21@gated-at.bofh.it> |
| In reply to | #1647635 |
On 05/23/2017 01:17 PM, Gang He wrote:
> This patch will fix a static code checker warning, which looks
> like below,
> fs/ocfs2/inode.c:179 ocfs2_iget()
> warn: passing zero to 'ERR_PTR'
>
> this warning was caused by the
> commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check").
> after apply this patch, the error return value will not be NULL(zero).
>
> Signed-off-by: Gang He <ghe@suse.com>
Looks good to me.
Reviewed-by: Eric Ren <zren@suse.com>
> ---
> fs/ocfs2/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
> index 382401d..1a1e007 100644
> --- a/fs/ocfs2/inode.c
> +++ b/fs/ocfs2/inode.c
> @@ -136,7 +136,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno)
> struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags,
> int sysfile_type)
> {
> - int rc = 0;
> + int rc = -ESTALE;
> struct inode *inode = NULL;
> struct super_block *sb = osb->sb;
> struct ocfs2_find_inode_args args;
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web