Message ID | 20240416123427.614899-5-aalbersh@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | xfsprogs random fixes found by Coverity scan | expand |
On Tue, Apr 16, 2024 at 02:34:26PM +0200, Andrey Albershteyn wrote: > If unicrash_load() fails, all_pi can be used uninitialized in > phase_end(). Fix it by going to the unload: section if unicrash_load > fails and just go with unicrash_unload() (the is_service won't be > initialized here). > > Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com> > --- > scrub/xfs_scrub.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c > index 752180d646ba..d226721d1dd7 100644 > --- a/scrub/xfs_scrub.c > +++ b/scrub/xfs_scrub.c > @@ -631,7 +631,7 @@ main( > fprintf(stderr, > _("%s: couldn't initialize Unicode library.\n"), > progname); > - goto out; > + goto unload; Rename this label out_unicrash to describe what piece will be unloaded, and you can add: Reviewed-by: Darrick J. Wong <djwong@kernel.org> --D > } > > pthread_mutex_init(&ctx.lock, NULL); > @@ -828,6 +828,7 @@ out: > phase_end(&all_pi, 0); > if (progress_fp) > fclose(progress_fp); > +unload: > unicrash_unload(); > > /* > -- > 2.42.0 > >
diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c index 752180d646ba..d226721d1dd7 100644 --- a/scrub/xfs_scrub.c +++ b/scrub/xfs_scrub.c @@ -631,7 +631,7 @@ main( fprintf(stderr, _("%s: couldn't initialize Unicode library.\n"), progname); - goto out; + goto unload; } pthread_mutex_init(&ctx.lock, NULL); @@ -828,6 +828,7 @@ out: phase_end(&all_pi, 0); if (progress_fp) fclose(progress_fp); +unload: unicrash_unload(); /*
If unicrash_load() fails, all_pi can be used uninitialized in phase_end(). Fix it by going to the unload: section if unicrash_load fails and just go with unicrash_unload() (the is_service won't be initialized here). Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com> --- scrub/xfs_scrub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)