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: <93f18533-da95-4f29-b6d9-8b8337a4cc90@wanadoo.fr>
Date: Fri, 9 Aug 2024 10:41:55 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: matteomartelli3@...il.com
Cc: dan.carpenter@...aro.org, jic23@...nel.org,
 kernel-janitors@...r.kernel.org, lars@...afoo.de, linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: adc: pac1921: add missing error return in probe()

Le 09/08/2024 à 09:31, Matteo Martelli a écrit :
> Christophe JAILLET wrote:
>> Le 08/08/2024 à 21:28, Dan Carpenter a écrit :
>>> This error path was intended to return, and not just print an error.  The
>>> current code will lead to an error pointer dereference.
>>>
>>> Fixes: 371f778b83cd ("iio: adc: add support for pac1921")
>>> Signed-off-by: Dan Carpenter <dan.carpenter-QSEj5FYQhm4dnm+yROfE0A@...lic.gmane.org>
>>> ---
>>>    drivers/iio/adc/pac1921.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/iio/adc/pac1921.c b/drivers/iio/adc/pac1921.c
>>> index d04c6685d780..8200a47bdf21 100644
>>> --- a/drivers/iio/adc/pac1921.c
>>> +++ b/drivers/iio/adc/pac1921.c
>>> @@ -1168,8 +1168,8 @@ static int pac1921_probe(struct i2c_client *client)
>>>    
>>>    	priv->regmap = devm_regmap_init_i2c(client, &pac1921_regmap_config);
>>>    	if (IS_ERR(priv->regmap))
>>> -		dev_err_probe(dev, (int)PTR_ERR(priv->regmap),
>>> -			      "Cannot initialize register map\n");
>>> +		return dev_err_probe(dev, (int)PTR_ERR(priv->regmap),
>>
>> The (int) is unusual.
>>
> The (int) explicit cast is to address Wconversion warnings since dev_err_probe
> takes an int as argument.

Ok, but:

1) With the cast removed, on my x86_64:
	$ make CFLAGS="-Wconversion" drivers/iio/adc/pac1921.o

doesn't generate any error.

2)
	$ it grep dev_err_probe.*\)PTR_ERR | wc -l
	2

	$ it grep dev_err_probe.*PTR_ERR | wc -l
	1948
So, should the cast be needed, maybe another fix could make sense?

CJ

>>
>> CJ
>>
>>> +				     "Cannot initialize register map\n");
>>>    
>>>    	devm_mutex_init(dev, &priv->lock);
>>>    
>>
> 
> Thanks,
> Matteo Martelli
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ