* [PATCH] repair: fix an uninitialized variable issue
@ 2021-04-21 14:41 Gao Xiang
2021-04-21 15:53 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2021-04-21 14:41 UTC (permalink / raw)
To: linux-xfs; +Cc: Gao Xiang
An uninitialized variable issue reported by Coverity, it seems
the following for-loop can be exited in advance with isblock == 1,
and bp is still uninitialized.
In case of that, initialize bp as NULL in advance to avoid this.
Fixes: 1f7c7553489c ("repair: don't duplicate names in phase 6")
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
repair/phase6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/repair/phase6.c b/repair/phase6.c
index 72287b5c..6bddfefa 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -2195,7 +2195,7 @@ longform_dir2_entry_check(
int ino_offset,
struct dir_hash_tab *hashtab)
{
- struct xfs_buf *bp;
+ struct xfs_buf *bp = NULL;
xfs_dablk_t da_bno;
freetab_t *freetab;
int i;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] repair: fix an uninitialized variable issue
2021-04-21 14:41 [PATCH] repair: fix an uninitialized variable issue Gao Xiang
@ 2021-04-21 15:53 ` Darrick J. Wong
2021-04-21 16:26 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2021-04-21 15:53 UTC (permalink / raw)
To: Gao Xiang; +Cc: linux-xfs
On Wed, Apr 21, 2021 at 10:41:35PM +0800, Gao Xiang wrote:
> An uninitialized variable issue reported by Coverity, it seems
Minor nit: we often include the coverity id for things it finds.
Links to a semi-private corporate bug tracker aren't necessarily
generally useful, but I guess they did find a legit bug so we could
throw them one crumb.
> the following for-loop can be exited in advance with isblock == 1,
> and bp is still uninitialized.
>
> In case of that, initialize bp as NULL in advance to avoid this.
>
> Fixes: 1f7c7553489c ("repair: don't duplicate names in phase 6")
> Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Either way, it's not worth holding up this patch, so:
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> repair/phase6.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/repair/phase6.c b/repair/phase6.c
> index 72287b5c..6bddfefa 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -2195,7 +2195,7 @@ longform_dir2_entry_check(
> int ino_offset,
> struct dir_hash_tab *hashtab)
> {
> - struct xfs_buf *bp;
> + struct xfs_buf *bp = NULL;
> xfs_dablk_t da_bno;
> freetab_t *freetab;
> int i;
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] repair: fix an uninitialized variable issue
2021-04-21 15:53 ` Darrick J. Wong
@ 2021-04-21 16:26 ` Eric Sandeen
0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2021-04-21 16:26 UTC (permalink / raw)
To: Darrick J. Wong, Gao Xiang; +Cc: linux-xfs
On 4/21/21 10:53 AM, Darrick J. Wong wrote:
> On Wed, Apr 21, 2021 at 10:41:35PM +0800, Gao Xiang wrote:
>> An uninitialized variable issue reported by Coverity, it seems
>
> Minor nit: we often include the coverity id for things it finds.
> Links to a semi-private corporate bug tracker aren't necessarily
> generally useful, but I guess they did find a legit bug so we could
> throw them one crumb.
>
>> the following for-loop can be exited in advance with isblock == 1,
>> and bp is still uninitialized.
>>
>> In case of that, initialize bp as NULL in advance to avoid this.
>>
>> Fixes: 1f7c7553489c ("repair: don't duplicate names in phase 6")
>> Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
>
> Either way, it's not worth holding up this patch, so:
>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Thanks Darrick and Gao. Easy enough for me to add the coverity ID on commit.
-Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-21 16:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 14:41 [PATCH] repair: fix an uninitialized variable issue Gao Xiang
2021-04-21 15:53 ` Darrick J. Wong
2021-04-21 16:26 ` Eric Sandeen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.