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]
Date:   Tue, 6 Sep 2022 15:54:06 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:     linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        Hans de Goede <hdegoede@...hat.com>
Subject: Re: [PATCH v1 1/1] Input: icn8505 - Utilize acpi_get_subsystem_id()

On Mon, Sep 05, 2022 at 12:35:42PM -0700, Dmitry Torokhov wrote:
> On Mon, Sep 05, 2022 at 08:20:01PM +0300, Andy Shevchenko wrote:

...

> > +	subsys = acpi_get_subsystem_id(ACPI_HANDLE(dev));
> > +	if (IS_ERR(subsys) && PTR_ERR(subsys) != -ENODATA)
> > +		return PTR_ERR(subsys);
> > +
> > +	if (IS_ERR(subsys) && PTR_ERR(subsys) == -ENODATA)
> > +		subsys = kstrdup_const("unknown", GFP_KERNEL);
> 
> Do we really need kstrdup_const() here? This makes me wonder if we need
> to also have error handling here, and if we going to tip some automated
> tools by not having it. Why can't we simply assign the constant here
> (and continue using kfree_const() below)?

Which makes code inconsistent. But okay, no big deal.

> I think this is the case where PTR_ERR_OR_ZERO() might help avoid
> multiple IS_ERR/PTR_ERR:
> 
> 	subsys = acpi_get_subsystem_id(ACPI_HANDLE(dev));
> 	error = PTR_ERR_OR_ZERO(subsys);
> 	if (error == -ENODATA)
> 		subsys = "unknown";
> 	else if (error)
> 		return error;

Would it matter? The generated code will be the same in both cases, no?

> >  	snprintf(icn8505->firmware_name, sizeof(icn8505->firmware_name),
> >  		 "chipone/icn8505-%s.fw", subsys);
> >  
> > -	kfree(buffer.pointer);
> > +	kfree_const(subsys);
> >  	return 0;

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ