2019-11-06 15:56:16

by Colin King

[permalink] [raw]
Subject: [PATCH][next] xfs: remove redundant assignment to variable error

From: Colin Ian King <[email protected]>

Variable error is being initialized with a value that is never read
and is being re-assigned a couple of statements later on. The
assignment is redundant and hence can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
---
fs/xfs/xfs_super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index b3188ea49413..2302f67d1a18 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1362,7 +1362,7 @@ xfs_fc_fill_super(
{
struct xfs_mount *mp = sb->s_fs_info;
struct inode *root;
- int flags = 0, error = -ENOMEM;
+ int flags = 0, error;

mp->m_super = sb;

--
2.20.1


2019-11-06 15:59:34

by Darrick J. Wong

[permalink] [raw]
Subject: Re: [PATCH][next] xfs: remove redundant assignment to variable error

On Wed, Nov 06, 2019 at 03:52:48PM +0000, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> Variable error is being initialized with a value that is never read
> and is being re-assigned a couple of statements later on. The
> assignment is redundant and hence can be removed.
>
> Addresses-Coverity: ("Unused value")

Er... is there a coverity id that goes with this?

Patch looks fine otherwise.

--D

> Signed-off-by: Colin Ian King <[email protected]>
> ---
> fs/xfs/xfs_super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index b3188ea49413..2302f67d1a18 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1362,7 +1362,7 @@ xfs_fc_fill_super(
> {
> struct xfs_mount *mp = sb->s_fs_info;
> struct inode *root;
> - int flags = 0, error = -ENOMEM;
> + int flags = 0, error;
>
> mp->m_super = sb;
>
> --
> 2.20.1
>

2019-11-06 16:00:47

by Colin King

[permalink] [raw]
Subject: Re: [PATCH][next] xfs: remove redundant assignment to variable error

On 06/11/2019 15:56, Darrick J. Wong wrote:
> On Wed, Nov 06, 2019 at 03:52:48PM +0000, Colin King wrote:
>> From: Colin Ian King <[email protected]>
>>
>> Variable error is being initialized with a value that is never read
>> and is being re-assigned a couple of statements later on. The
>> assignment is redundant and hence can be removed.
>>
>> Addresses-Coverity: ("Unused value")
>
> Er... is there a coverity id that goes with this?

Unfortunately it is a private one, so it does not make sense to use it.

>
> Patch looks fine otherwise.
>
> --D
>
>> Signed-off-by: Colin Ian King <[email protected]>
>> ---
>> fs/xfs/xfs_super.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>> index b3188ea49413..2302f67d1a18 100644
>> --- a/fs/xfs/xfs_super.c
>> +++ b/fs/xfs/xfs_super.c
>> @@ -1362,7 +1362,7 @@ xfs_fc_fill_super(
>> {
>> struct xfs_mount *mp = sb->s_fs_info;
>> struct inode *root;
>> - int flags = 0, error = -ENOMEM;
>> + int flags = 0, error;
>>
>> mp->m_super = sb;
>>
>> --
>> 2.20.1
>>

2019-11-06 16:20:58

by Eric Sandeen

[permalink] [raw]
Subject: Re: [PATCH][next] xfs: remove redundant assignment to variable error



On 11/6/19 9:59 AM, Colin Ian King wrote:
> On 06/11/2019 15:56, Darrick J. Wong wrote:
>> On Wed, Nov 06, 2019 at 03:52:48PM +0000, Colin King wrote:
>>> From: Colin Ian King <[email protected]>
>>>
>>> Variable error is being initialized with a value that is never read
>>> and is being re-assigned a couple of statements later on. The
>>> assignment is redundant and hence can be removed.
>>>
>>> Addresses-Coverity: ("Unused value")
>>
>> Er... is there a coverity id that goes with this?
>
> Unfortunately it is a private one, so it does not make sense to use it.

If it's not in the upstream coverity scan (and AFAICT it's not),
it makes no sense to reference coverity in the commit log.
It's not useful to anyone IMHO.

-Eric

2019-11-06 16:35:47

by Colin King

[permalink] [raw]
Subject: Re: [PATCH][next] xfs: remove redundant assignment to variable error

On 06/11/2019 16:19, Eric Sandeen wrote:
>
>
> On 11/6/19 9:59 AM, Colin Ian King wrote:
>> On 06/11/2019 15:56, Darrick J. Wong wrote:
>>> On Wed, Nov 06, 2019 at 03:52:48PM +0000, Colin King wrote:
>>>> From: Colin Ian King <[email protected]>
>>>>
>>>> Variable error is being initialized with a value that is never read
>>>> and is being re-assigned a couple of statements later on. The
>>>> assignment is redundant and hence can be removed.
>>>>
>>>> Addresses-Coverity: ("Unused value")
>>>
>>> Er... is there a coverity id that goes with this?
>>
>> Unfortunately it is a private one, so it does not make sense to use it.
>
> If it's not in the upstream coverity scan (and AFAICT it's not),

that's because I'm using coverity with improved tuned coverage settings
and coverity scan is just set on the default low setting.

> it makes no sense to reference coverity in the commit log.
> It's not useful to anyone IMHO.

It's useful for tracking which bugs are being picked up with Coverity
and the kind of bug issue. I'm trying to gather stats on static analysis
fixes that land in linux to help catagorize the types of issues with
fixes landing upstream.

>
> -Eric
>

2019-11-06 16:57:21

by Eric Sandeen

[permalink] [raw]
Subject: Re: [PATCH][next] xfs: remove redundant assignment to variable error

On 11/6/19 10:33 AM, Colin Ian King wrote:
> On 06/11/2019 16:19, Eric Sandeen wrote:
>>
>>
>> On 11/6/19 9:59 AM, Colin Ian King wrote:
>>> On 06/11/2019 15:56, Darrick J. Wong wrote:
>>>> On Wed, Nov 06, 2019 at 03:52:48PM +0000, Colin King wrote:
>>>>> From: Colin Ian King <[email protected]>
>>>>>
>>>>> Variable error is being initialized with a value that is never read
>>>>> and is being re-assigned a couple of statements later on. The
>>>>> assignment is redundant and hence can be removed.
>>>>>
>>>>> Addresses-Coverity: ("Unused value")
>>>>
>>>> Er... is there a coverity id that goes with this?
>>>
>>> Unfortunately it is a private one, so it does not make sense to use it.
>>
>> If it's not in the upstream coverity scan (and AFAICT it's not),
>
> that's because I'm using coverity with improved tuned coverage settings
> and coverity scan is just set on the default low setting.
>
>> it makes no sense to reference coverity in the commit log.
>> It's not useful to anyone IMHO.
>
> It's useful for tracking which bugs are being picked up with Coverity
> and the kind of bug issue. I'm trying to gather stats on static analysis
> fixes that land in linux to help catagorize the types of issues with
> fixes landing upstream.

The commit log is public.

The way you've tagged the commit really makes no sense to anyone outside
of your org.

Maybe:

Reported-by: Internal Coverity instance

or something would make more sense to the general public?

-Eric

2019-11-07 06:45:35

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH][next] xfs: remove redundant assignment to variable error

On Wed, Nov 06, 2019 at 10:19:18AM -0600, Eric Sandeen wrote:
>
>
> On 11/6/19 9:59 AM, Colin Ian King wrote:
> > On 06/11/2019 15:56, Darrick J. Wong wrote:
> >> On Wed, Nov 06, 2019 at 03:52:48PM +0000, Colin King wrote:
> >>> From: Colin Ian King <[email protected]>
> >>>
> >>> Variable error is being initialized with a value that is never read
> >>> and is being re-assigned a couple of statements later on. The
> >>> assignment is redundant and hence can be removed.
> >>>
> >>> Addresses-Coverity: ("Unused value")
> >>
> >> Er... is there a coverity id that goes with this?
> >
> > Unfortunately it is a private one, so it does not make sense to use it.
>
> If it's not in the upstream coverity scan (and AFAICT it's not),
> it makes no sense to reference coverity in the commit log.
> It's not useful to anyone IMHO.
>

It's sort of useful if want to see how the bug was found or if you want
to count how many bugs coverity finds... I'm pretty sure I remember
someone complaining that it wasn't mentioned in the commit.

regards,
dan carpenter