lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 10 Mar 2019 13:07:32 +0800
From:   Sean Fu <fxinrong@...il.com>
To:     "Darrick J. Wong" <darrick.wong@...cle.com>
Cc:     Sean Fu <fxinrong@...il.com>, linux-xfs@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] xfs: Use kmem_zalloc for bp->b_pages.

On Sat, Mar 09, 2019 at 09:32:30AM -0800, Darrick J. Wong wrote:
> On Sat, Mar 09, 2019 at 11:36:36PM +0800, Sean Fu wrote:
> > Change the allocation of bp->b_pages to use kmem_zalloc instead of
> > kmem_alloc.
> > Remove unnecessary memset for bp->b_pages.
> >
> > This reduces text size by 42 bytes.
> > Before:
> >    text	   data	    bss	    dec	    hex	filename
> >   23335	    588	      8	  23931	   5d7b	./fs/xfs/xfs_buf.o
> > After:
> >    text	   data	    bss	    dec	    hex	filename
> >   23293	    588	      8	  23889	   5d51	./fs/xfs/xfs_buf.o
> >
> > Signed-off-by: Sean Fu <fxinrong@...il.com>
> > ---
> >  fs/xfs/xfs_buf.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index 4f5f2ff3f70f..be4f740b97c1 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -289,12 +289,11 @@ _xfs_buf_get_pages(
> >  		if (page_count <= XB_PAGES) {
> >  			bp->b_pages = bp->b_page_array;
> >  		} else {
> > -			bp->b_pages = kmem_alloc(sizeof(struct page *) *
> > +			bp->b_pages = kmem_zalloc(sizeof(struct page *) *
> >  						 page_count, KM_NOFS);
> >  			if (bp->b_pages == NULL)
> >  				return -ENOMEM;
> >  		}
> > -		memset(bp->b_pages, 0, sizeof(struct page *) * page_count);
>
> Does this leave b_pages uninitialized in the page_count <= XB_PAGES
> case?
bp is allocated by kmem_zone_zalloc, But i will take a deep look at xfs_buf_associate_memory.
>
> --D
>
> >  	}
> >  	return 0;
> >  }
> > --
> > 2.16.4
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ