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: <ZQr3E/7crMrVxMp9@smile.fi.intel.com>
Date:   Wed, 20 Sep 2023 16:43:47 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        Kent Gibson <warthog618@...il.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        akpm@...ux-foundation.org, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v5] gpio: sim: fix an invalid __free() usage

On Wed, Sep 20, 2023 at 09:32:53AM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> 
> gpio_sim_make_line_names() returns NULL or ERR_PTR() so we must not use
> __free(kfree) on the returned address. Split this function into two, one
> that determines the size of the "gpio-line-names" array to allocate and
> one that actually sets the names at correct offsets. The allocation and
> assignment of the managed pointer happens in between.

...

>  	list_for_each_entry(line, &bank->line_list, siblings) {
> -		if (line->offset >= bank->num_lines)
> +		if (!line->name || (line->offset >= bank->num_lines))
>  			continue;
>  
> -		if (line->name) {
> -			if (line->offset > max_offset)
> -				max_offset = line->offset;
> -
> -			/*
> -			 * max_offset can stay at 0 so it's not an indicator
> -			 * of whether line names were configured at all.
> -			 */
> -			has_line_names = true;
> -		}
> +		size = max(size, line->offset + 1);
>  	}

As for the material to be backported it's fine, but I'm wondering if we
actually can add the entries in a sorted manner, so we would need the exact
what I mentioned in previous review round, just search backwards to the first
satisfying entry. I don't believe the adding an entry to the list is a
hot-path, so would be fine to call list_sort().

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ