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: <ZL5UeqLJirqkezyx@smile.fi.intel.com>
Date:   Mon, 24 Jul 2023 13:37:46 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Jonathan Cameron <jic23@...nel.org>
Cc:     linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Lars-Peter Clausen <lars@...afoo.de>,
        Nuno Sa <nuno.sa@...log.com>
Subject: Re: [PATCH v2 3/8] iio: core: Switch to krealloc_array()

On Sat, Jul 22, 2023 at 06:28:20PM +0100, Jonathan Cameron wrote:
> On Fri, 21 Jul 2023 20:00:17 +0300
> Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:

...

> > +		krealloc_array(attrs, attrcount + 1, sizeof(*attrs), GFP_KERNEL);
> 
> 
> I'm a little lost, but isn't this realloc()ing attrs, which should be provided
> by drivers as constant if it is set to indio_dev->info->attrs->attrs? 
> 
> That seems unlikely to work correctly, but I may well have lost track of the
> flow and attrs points somewhere else at this point.  I guess it might work
> as the realloc code will detect it can't resize that array.

Argh!

The attrs are defined without const. So, basically to prevent code like this
we have to make sure our local variables are defined as const.

I will drop this hunk from the next version, need to think if it makes sense
to refactor and if so, in which way.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ