diff mbox series

[3/5] xfs_io: init count to stop loop from execution

Message ID 20240416123427.614899-4-aalbersh@redhat.com (mailing list archive)
State Accepted, archived
Headers show
Series xfsprogs random fixes found by Coverity scan | expand

Commit Message

Andrey Albershteyn April 16, 2024, 12:34 p.m. UTC
jdm_parentpaths() doesn't initialize count. If count happens to be
non-zero, following loop can result in access overflow.

Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
---
 io/parent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Darrick J. Wong April 16, 2024, 4:15 p.m. UTC | #1
On Tue, Apr 16, 2024 at 02:34:25PM +0200, Andrey Albershteyn wrote:
> jdm_parentpaths() doesn't initialize count. If count happens to be
> non-zero, following loop can result in access overflow.
> 
> Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
> ---
>  io/parent.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/io/parent.c b/io/parent.c
> index 8f63607ffec2..5750d98a3b75 100644
> --- a/io/parent.c
> +++ b/io/parent.c
> @@ -112,7 +112,7 @@ check_parents(parent_t *parentbuf, size_t *parentbuf_size,

check_parents is an artifact of the old sgi parent pointers code and
(apparently) its need to check parent pointer correctness via xfs_io
commands.  The Linux parent pointers patchset fixed all those
referential integrity problems (thanks, Allison!) and will blow this
away, so I think we should ignore this report:

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfsprogs-dev.git/commit/io/parent.c?h=pptrs&id=c0854b85c1e8c90ea3eea930a20d1323e61ddb40

--D

>  	     jdm_fshandle_t *fshandlep, struct xfs_bstat *statp)
>  {
>  	int error, i;
> -	__u32 count;
> +	__u32 count = 0;
>  	parent_t *entryp;
>  
>  	do {
> -- 
> 2.42.0
> 
>
Andrey Albershteyn April 16, 2024, 4:22 p.m. UTC | #2
On 2024-04-16 09:15:30, Darrick J. Wong wrote:
> On Tue, Apr 16, 2024 at 02:34:25PM +0200, Andrey Albershteyn wrote:
> > jdm_parentpaths() doesn't initialize count. If count happens to be
> > non-zero, following loop can result in access overflow.
> > 
> > Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
> > ---
> >  io/parent.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/io/parent.c b/io/parent.c
> > index 8f63607ffec2..5750d98a3b75 100644
> > --- a/io/parent.c
> > +++ b/io/parent.c
> > @@ -112,7 +112,7 @@ check_parents(parent_t *parentbuf, size_t *parentbuf_size,
> 
> check_parents is an artifact of the old sgi parent pointers code and
> (apparently) its need to check parent pointer correctness via xfs_io
> commands.  The Linux parent pointers patchset fixed all those
> referential integrity problems (thanks, Allison!) and will blow this
> away, so I think we should ignore this report:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfsprogs-dev.git/commit/io/parent.c?h=pptrs&id=c0854b85c1e8c90ea3eea930a20d1323e61ddb40

I see, thanks, will drop this one

> 
> --D
> 
> >  	     jdm_fshandle_t *fshandlep, struct xfs_bstat *statp)
> >  {
> >  	int error, i;
> > -	__u32 count;
> > +	__u32 count = 0;
> >  	parent_t *entryp;
> >  
> >  	do {
> > -- 
> > 2.42.0
> > 
> > 
>
diff mbox series

Patch

diff --git a/io/parent.c b/io/parent.c
index 8f63607ffec2..5750d98a3b75 100644
--- a/io/parent.c
+++ b/io/parent.c
@@ -112,7 +112,7 @@  check_parents(parent_t *parentbuf, size_t *parentbuf_size,
 	     jdm_fshandle_t *fshandlep, struct xfs_bstat *statp)
 {
 	int error, i;
-	__u32 count;
+	__u32 count = 0;
 	parent_t *entryp;
 
 	do {