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] [day] [month] [year] [list]
Message-ID: <c67b209c-4237-4c9f-3150-23a3ef99bc34@gmail.com>
Date:   Wed, 15 Jun 2022 20:30:12 +0200
From:   Rafał Miłecki <zajec5@...il.com>
To:     Ahmad Fatoum <a.fatoum@...gutronix.de>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>
Cc:     Tom Rini <trini@...sulko.com>,
        linux-arm-kernel@...ts.infradead.org, u-boot@...ts.denx.de,
        devicetree@...r.kernel.org, linux-mtd@...ts.infradead.org,
        linux-kernel@...r.kernel.org,
        Rafał Miłecki <rafal@...ecki.pl>,
        Pengutronix Kernel Team <kernel@...gutronix.de>
Subject: Re: [PATCH V3 2/2] nvmem: add driver handling U-Boot environment
 variables

On 14.06.2022 08:45, Ahmad Fatoum wrote:
>> +	if (err && !mtd_is_bitflip(err)) {
>> +		dev_err(dev, "Failed to read from mtd: %d\n", err);
> 
> Nitpick: %pe

My "err" variable in int, not a pointer (I don't use PTR_ERR()).


>> +static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf,
>> +				size_t data_offset, size_t data_len)
>> +{
>> +	struct device *dev = priv->dev;
>> +	char *data = buf + data_offset;
>> +	char *var, *value, *eq;
>> +	int idx;
>> +
>> +	priv->ncells = 0;
>> +	for (var = data; var < data + data_len && *var; var += strlen(var) + 1)
>> +		priv->ncells++;
>> +
>> +	priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL);
>> +	if (!priv->cells)
>> +		return -ENOMEM;
>> +
>> +	for (var = data, idx = 0;
>> +	     var < data + data_len && *var;
>> +	     var = value + strlen(value) + 1, idx++) {
>> +		eq = strchr(var, '=');
>> +		if (!eq)
>> +			break;
>> +		*eq = '\0';
>> +		value = eq + 1;
>> +
>> +		priv->cells[idx].name = devm_kstrdup(dev, var, GFP_KERNEL);
>> +		if (!priv->cells[idx].name)
>> +			return -ENOMEM;
>> +		priv->cells[idx].offset = data_offset + value - data;
>> +		priv->cells[idx].bytes = strlen(value);
> 
> U-Boot environment can't hold binary values?

I believe it can't. In any case \0 is a always a separator.


>> +	}
>> +
>> +	if (WARN_ON(idx != priv->ncells))
>> +		priv->ncells = idx;
>> +
>> +	return 0;
>> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ