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]
Date:   Wed, 20 Mar 2019 08:22:37 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     George Hilliard <thirtythreeforty@...il.com>
Cc:     linux-mips@...ux-mips.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 07/11] staging: mt7621-mmc: Check for nonzero number
 of scatterlist entries

On Mon, Mar 18, 2019 at 08:20:08PM -0600, George Hilliard wrote:
> The buffer descriptor setup loop is correct only if it is setting up at
> least one bd struct.  Besides, there is an error somewhere if
> dma_map_sg() returns 0.  So add a paranoid check for this condition.
> 
> Signed-off-by: George Hilliard <thirtythreeforty@...il.com>
> ---
>  drivers/staging/mt7621-mmc/sd.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
> index c272aa780719..31c5b44bd29f 100644
> --- a/drivers/staging/mt7621-mmc/sd.c
> +++ b/drivers/staging/mt7621-mmc/sd.c
> @@ -593,7 +593,12 @@ static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma,
>  	struct bd *bd;
>  	u32 j;
>  
> -	BUG_ON(sglen > MAX_BD_NUM); /* not support currently */
> +	// Shouldn't happen; we configure the mmc host layer
> +	// based on MAX_BD_NUM:
> +	BUG_ON(sglen > MAX_BD_NUM);
> +	// Correct setup below requires at least one bd
> +	// (and dma_map_sg should not return 0):
> +	BUG_ON(sglen == 0);

Same here, no new BUG_ON().  To quote one kernel developer, "BUG_ON()
means that the programmer is lazy" :)

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ