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: <56e461b4-2cd8-ec89-86b2-68544826cf73@enneenne.com>
Date:   Fri, 30 Jun 2023 09:50:33 +0200
From:   Rodolfo Giometti <giometti@...eenne.com>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] include/uapi pps.h: drop not needed PPS_MAX_SOURCES
 define

On 30/06/23 09:31, Greg Kroah-Hartman wrote:
> On Fri, Jun 30, 2023 at 09:18:26AM +0200, Rodolfo Giometti wrote:
>> Userspace PPS clients should not known about how many PPS sources can
>> be defined within the system (nor the rfc2783 say so), so we can
>> safely drop this define since is not used anymore in the kernel too.
>>
>> Signed-off-by: Rodolfo Giometti <giometti@...eenne.com>
>> ---
>>   drivers/pps/pps.c        | 6 +++---
>>   include/uapi/linux/pps.h | 1 -
>>   2 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
>> index 5d19baae6a38..1a6131608036 100644
>> --- a/drivers/pps/pps.c
>> +++ b/drivers/pps/pps.c
>> @@ -354,7 +354,7 @@ int pps_register_cdev(struct pps_device *pps)
>>   	 * Get new ID for the new PPS source.  After idr_alloc() calling
>>   	 * the new source will be freely available into the kernel.
>>   	 */
>> -	err = idr_alloc(&pps_idr, pps, 0, PPS_MAX_SOURCES, GFP_KERNEL);
>> +	err = idr_alloc(&pps_idr, pps, 0, MINORMASK, GFP_KERNEL);
>>   	if (err < 0) {
>>   		if (err == -ENOSPC) {
>>   			pr_err("%s: too many PPS sources in the system\n",
>> @@ -449,7 +449,7 @@ EXPORT_SYMBOL(pps_lookup_dev);
>>   static void __exit pps_exit(void)
>>   {
>>   	class_destroy(pps_class);
>> -	unregister_chrdev_region(pps_devt, PPS_MAX_SOURCES);
>> +	unregister_chrdev_region(pps_devt, MINORMASK);
>>   }
>>   
>>   static int __init pps_init(void)
>> @@ -463,7 +463,7 @@ static int __init pps_init(void)
>>   	}
>>   	pps_class->dev_groups = pps_groups;
>>   
>> -	err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps");
>> +	err = alloc_chrdev_region(&pps_devt, 0, MINORMASK, "pps");
>>   	if (err < 0) {
>>   		pr_err("failed to allocate char device region\n");
>>   		goto remove_class;
>> diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h
>> index 90f2e86020ba..8a4096f18af1 100644
>> --- a/include/uapi/linux/pps.h
>> +++ b/include/uapi/linux/pps.h
>> @@ -26,7 +26,6 @@
>>   #include <linux/types.h>
>>   
>>   #define PPS_VERSION		"5.3.6"
>> -#define PPS_MAX_SOURCES		MINORMASK
> 
> Why change this in patch 1, and then delete this here?
> 
> That makes no sense.

I did it in two steps to be clear that the first step is about a better 
redefinition of the PPS_MAX_SOURCES define, while the second step is about the 
fact it's now that define is useless.

> And if this is exported to userspace, removing it should break things,
> right?  If not, why was it there in the first place?

In reality such define is not stated within the PPS RFC2783, so userspace 
programs whose relies on such define are broken.

Ciao,

Rodolfo

-- 
GNU/Linux Solutions                  e-mail: giometti@...eenne.com
Linux Device Driver                          giometti@...ux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ