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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 23 Nov 2022 10:52:24 +0100
From:   Michael Walle <michael@...le.cc>
To:     Sascha Hauer <sha@...gutronix.de>
Cc:     Jonathan Corbet <corbet@....net>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v3 17/18] nvmem: layouts: Add ONIE tlv layout driver

Am 2022-11-21 08:51, schrieb Sascha Hauer:
> On Fri, Nov 18, 2022 at 07:51:17PM +0100, Michael Walle wrote:
>> From: Miquel Raynal <miquel.raynal@...tlin.com>
>> 
>> This layout applies no top of any non volatile storage device 
>> containing
> 
> s/no/on/
> 
>> +	table_len = hdr_len + data_len;
>> +	if (table_len > ONIE_TLV_MAX_LEN) {
>> +		dev_err(dev, "Invalid ONIE TLV data length\n");
>> +		return -EINVAL;
>> +	}
>> +
>> +	table = devm_kmalloc(dev, table_len, GFP_KERNEL);
>> +	if (!table)
>> +		return -ENOMEM;
>> +
>> +	ret = nvmem_device_read(nvmem, 0, table_len, table);
>> +	if (ret != table_len)
>> +		goto free_data_buf;
>> +
>> +	if (!onie_tlv_crc_is_valid(dev, table_len, table)) {
>> +		ret = -EINVAL;
>> +		goto free_data_buf;
>> +	}
>> +
>> +	data = table + hdr_len;
>> +	ret = onie_tlv_add_cells(dev, nvmem, data_len, data);
>> +	if (ret)
>> +		goto free_data_buf;
>> +
>> +free_data_buf:
>> +	kfree(table);
> 
> This is allocated with devm_kmalloc(), you shouldn't free it here.

Miquel, should I drop your patches or should I fix this in place and
repost them?

Also, there is a mistake in nvmem_add_cells_from_layout() which doesn't
handle the return code. Probably a leftover from before when I had
.add_cells() return void.

-michael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ