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: <430b7f94-fb54-c4dc-8b11-a1d5c27edee0@ideasonboard.com>
Date:   Fri, 20 Jan 2023 18:00:58 +0200
From:   Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To:     Andy Shevchenko <andriy.shevchenko@...el.com>
Cc:     linux-media@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Wolfram Sang <wsa@...nel.org>,
        Luca Ceresoli <luca.ceresoli@...tlin.com>,
        Matti Vaittinen <Matti.Vaittinen@...rohmeurope.com>,
        Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Peter Rosin <peda@...ntia.se>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Michael Tretter <m.tretter@...gutronix.de>,
        Shawn Tu <shawnx.tu@...el.com>,
        Hans Verkuil <hverkuil@...all.nl>,
        Mike Pagano <mpagano@...too.org>,
        Krzysztof HaƂasa <khalasa@...p.pl>,
        Marek Vasut <marex@...x.de>,
        Luca Ceresoli <luca@...aceresoli.net>
Subject: Re: [PATCH v7 1/7] i2c: add I2C Address Translator (ATR) support

On 20/01/2023 17:58, Andy Shevchenko wrote:
> On Thu, Jan 19, 2023 at 12:01:33PM +0200, Tomi Valkeinen wrote:
>> On 18/01/2023 16:23, Andy Shevchenko wrote:
>>> On Wed, Jan 18, 2023 at 02:40:25PM +0200, Tomi Valkeinen wrote:
> 
> ...
> 
>>>> +	/* Ensure we have enough room to save the original addresses */
>>>> +	if (unlikely(chan->orig_addrs_size < num)) {
>>>> +		u16 *new_buf;
>>>> +
>>>> +		new_buf = kmalloc_array(num, sizeof(*new_buf), GFP_KERNEL);
>>>
>>> I remember that I asked why we don't use krealloc_array() here... Perhaps
>>> that we don't need to copy the old mapping table? Can we put a short comment
>>> to clarify this in the code?
>>
>> Yes, we don't care about the old data, we just require the buffer to be
>> large enough.
>>
>> I'm not sure what kind of comment you want here. Isn't this a common idiom,
>> where you have a buffer for temporary data, but you might need to resize at
>> some point if you need a larger one?
> 
> Then why not krealloc_array()? That's the question I want to see the answer for
> in the comments:
> 
> 	/* We don't care about old data, hence no realloc() */

Ok, I'll add that.

  Tomi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ