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: <cl5fmton3n5ayzr7ondnw7lzjaxoppyqhnoervj2fn4et75ish@cyko4abxbslg>
Date: Fri, 12 Apr 2024 19:03:01 +0200
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	Raag Jadav <raag.jadav@...el.com>, linux-kernel@...r.kernel.org, kernel@...gutronix.de, 
	"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH] driver core: Make dev_err_probe() silent for -ENOMEM

Hello Andy,

On Fri, Apr 12, 2024 at 07:51:48PM +0300, Andy Shevchenko wrote:
> On Fri, Apr 12, 2024 at 06:44:05PM +0200, Uwe Kleine-König wrote:
> > For an out-of-memory error there should be no additional output. Adapt
> > dev_err_probe() to not emit the error message when err is -ENOMEM.
> > This simplifies handling errors that might among others be -ENOMEM.
> 
> ...
> 
> 	BUILD_BUG_ON(err == -ENOMEM);
> 
> Done!

Well no, that doesn't do the trick. Consider for example device_add().
That function can return (at least) -EINVAL and -ENOMEM. To properly
ensure that the error handling is silent with the current
dev_err_probe(), we'd need to do:

	ret = device_add(...);
	if (ret) {
		if (ret != -ENOMEM)
			return dev_err_probe(...);
		else
			return ret;
	}

With my suggested patch this can be reduced to:

	ret = device_add(...);
	if (ret)
		return dev_err_probe(...);

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ