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: <Z6HmjEBIOfQYomXc@opensource.cirrus.com>
Date: Tue, 4 Feb 2025 10:06:04 +0000
From: Charles Keepax <ckeepax@...nsource.cirrus.com>
To: Fred Treven <ftreven@...nsource.cirrus.com>
CC: Simon Trimmer <simont@...nsource.cirrus.com>,
        Richard Fitzgerald
	<rf@...nsource.cirrus.com>,
        <patches@...nsource.cirrus.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/7] firmware: cs_dsp: Check for valid num_regs in
 cs_dsp_wseq_multi_write()

On Fri, Jan 31, 2025 at 01:56:33PM -0600, Fred Treven wrote:
> If a value of 0 or below is passed into cs_dsp_wseq_multi_write()
> the function will never enter its for loop.
> 
> Verify that num_regs passed into the function is valid
> and throw a user-visible error if not.
> 
> Signed-off-by: Fred Treven <ftreven@...nsource.cirrus.com>
> ---
>  drivers/firmware/cirrus/cs_dsp.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
> index 56315b0b5583..aacf6960d1ea 100644
> --- a/drivers/firmware/cirrus/cs_dsp.c
> +++ b/drivers/firmware/cirrus/cs_dsp.c
> @@ -3743,6 +3743,11 @@ int cs_dsp_wseq_multi_write(struct cs_dsp *dsp, struct cs_dsp_wseq *wseq,
>  {
>  	int i, ret;
>  
> +	if (num_regs <= 0) {
> +		cs_dsp_err(dsp, "Invalid number of regs: %d\n", num_regs);
> +		return -EINVAL;
> +	}
> +

This feels a little defensive, do we really need to check for
this? Normally num_regs is going to come from an ARRAY_SIZE or
something.

Thanks,
Charles

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ