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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <369459745a8f8e43f80c47bae554829dad8f635c.camel@kernel.org>
Date: Sat, 21 Jun 2025 14:46:58 -0400
From: Jeff Layton <jlayton@...nel.org>
To: Sergey Bashirov <sergeybashirov@...il.com>, Chuck Lever
	 <chuck.lever@...cle.com>, Christoph Hellwig <hch@...radead.org>, NeilBrown
	 <neil@...wn.name>, Olga Kornievskaia <okorniev@...hat.com>, Dai Ngo
	 <Dai.Ngo@...cle.com>, Tom Talpey <tom@...pey.com>
Cc: linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org, Konstantin
 Evtushenko <koevtushenko@...dex.com>
Subject: Re: [PATCH v4 1/2] nfsd: Drop dprintk in blocklayout xdr functions

On Sat, 2025-06-21 at 19:52 +0300, Sergey Bashirov wrote:
> Minor clean up. Instead of dprintk there are appropriate error codes.
> 
> Signed-off-by: Sergey Bashirov <sergeybashirov@...il.com>
> ---
>  fs/nfsd/blocklayoutxdr.c | 40 +++++++---------------------------------
>  1 file changed, 7 insertions(+), 33 deletions(-)
> 
> diff --git a/fs/nfsd/blocklayoutxdr.c b/fs/nfsd/blocklayoutxdr.c
> index 669ff8e6e966..bcf21fde9120 100644
> --- a/fs/nfsd/blocklayoutxdr.c
> +++ b/fs/nfsd/blocklayoutxdr.c
> @@ -139,28 +139,19 @@ nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
>  	struct iomap *iomaps;
>  	u32 nr_iomaps, i;
>  
> -	if (len < sizeof(u32)) {
> -		dprintk("%s: extent array too small: %u\n", __func__, len);
> +	if (len < sizeof(u32))
>  		return nfserr_bad_xdr;
> -	}
>  	len -= sizeof(u32);
> -	if (len % PNFS_BLOCK_EXTENT_SIZE) {
> -		dprintk("%s: extent array invalid: %u\n", __func__, len);
> +	if (len % PNFS_BLOCK_EXTENT_SIZE)
>  		return nfserr_bad_xdr;
> -	}
>  
>  	nr_iomaps = be32_to_cpup(p++);
> -	if (nr_iomaps != len / PNFS_BLOCK_EXTENT_SIZE) {
> -		dprintk("%s: extent array size mismatch: %u/%u\n",
> -			__func__, len, nr_iomaps);
> +	if (nr_iomaps != len / PNFS_BLOCK_EXTENT_SIZE)
>  		return nfserr_bad_xdr;
> -	}
>  
>  	iomaps = kcalloc(nr_iomaps, sizeof(*iomaps), GFP_KERNEL);
> -	if (!iomaps) {
> -		dprintk("%s: failed to allocate extent array\n", __func__);
> +	if (!iomaps)
>  		return nfserr_delay;
> -	}
>  
>  	for (i = 0; i < nr_iomaps; i++) {
>  		struct pnfs_block_extent bex;
> @@ -170,26 +161,18 @@ nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
>  
>  		p = xdr_decode_hyper(p, &bex.foff);
>  		if (bex.foff & (block_size - 1)) {
> -			dprintk("%s: unaligned offset 0x%llx\n",
> -				__func__, bex.foff);
>  			goto fail;
>  		}
>  		p = xdr_decode_hyper(p, &bex.len);
>  		if (bex.len & (block_size - 1)) {
> -			dprintk("%s: unaligned length 0x%llx\n",
> -				__func__, bex.foff);
>  			goto fail;
>  		}
>  		p = xdr_decode_hyper(p, &bex.soff);
>  		if (bex.soff & (block_size - 1)) {
> -			dprintk("%s: unaligned disk offset 0x%llx\n",
> -				__func__, bex.soff);
>  			goto fail;
>  		}
>  		bex.es = be32_to_cpup(p++);
>  		if (bex.es != PNFS_BLOCK_READWRITE_DATA) {
> -			dprintk("%s: incorrect extent state %d\n",
> -				__func__, bex.es);
>  			goto fail;
>  		}
>  
> @@ -231,38 +214,29 @@ nfsd4_scsi_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
>  	struct iomap *iomaps;
>  	u32 nr_iomaps, expected, i;
>  
> -	if (len < sizeof(u32)) {
> -		dprintk("%s: extent array too small: %u\n", __func__, len);
> +	if (len < sizeof(u32))
>  		return nfserr_bad_xdr;
> -	}
>  
>  	nr_iomaps = be32_to_cpup(p++);
>  	expected = sizeof(__be32) + nr_iomaps * PNFS_SCSI_RANGE_SIZE;
> -	if (len != expected) {
> -		dprintk("%s: extent array size mismatch: %u/%u\n",
> -			__func__, len, expected);
> +	if (len != expected)
>  		return nfserr_bad_xdr;
> -	}
>  
>  	iomaps = kcalloc(nr_iomaps, sizeof(*iomaps), GFP_KERNEL);
> -	if (!iomaps) {
> -		dprintk("%s: failed to allocate extent array\n", __func__);
> +	if (!iomaps)
>  		return nfserr_delay;
> -	}
>  
>  	for (i = 0; i < nr_iomaps; i++) {
>  		u64 val;
>  
>  		p = xdr_decode_hyper(p, &val);
>  		if (val & (block_size - 1)) {
> -			dprintk("%s: unaligned offset 0x%llx\n", __func__, val);
>  			goto fail;
>  		}
>  		iomaps[i].offset = val;
>  
>  		p = xdr_decode_hyper(p, &val);
>  		if (val & (block_size - 1)) {
> -			dprintk("%s: unaligned length 0x%llx\n", __func__, val);
>  			goto fail;
>  		}
>  		iomaps[i].length = val;

Looks sane, and most of these dprintks aren't terribly helpful for day
to day usage.

Reviewed-by: Jeff Layton <jlayton@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ