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: <e7a6add0-5526-4efd-8b00-07e399e292c1@kylinos.cn>
Date: Mon, 22 Jan 2024 15:47:01 +0800
From: Kunwu Chan <chentao@...inos.cn>
To: Markus Elfring <Markus.Elfring@....de>, xen-devel@...ts.xenproject.org,
 kernel-janitors@...r.kernel.org, Boris Ostrovsky
 <boris.ostrovsky@...cle.com>, Borislav Petkov <bp@...en8.de>,
 Dave Hansen <dave.hansen@...ux.intel.com>, "H. Peter Anvin" <hpa@...or.com>,
 Ingo Molnar <mingo@...hat.com>, Jürgen Groß
 <jgross@...e.com>, Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org
Cc: kernel test robot <lkp@...el.com>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] x86/xen: Add some null pointer checking to smp.c

On 2024/1/19 18:40, Markus Elfring wrote:
>> kasprintf() returns a pointer to dynamically allocated memory
>> which can be NULL upon failure. Ensure the allocation was successful
>> by checking the pointer validity.
> …
>> ---
>> Changes in v3:
>>      - Remove rc initialization
>>      - Simply error paths by adding a new label 'fail_mem'
> …
> 
> I became curious if you would like to simplify further source code places.
This function hasn't changed in years, so it's OK for now.
> 
> 
>> +++ b/arch/x86/xen/smp.c
>> @@ -65,6 +65,8 @@ int xen_smp_intr_init(unsigned int cpu)
>>   	char *resched_name, *callfunc_name, *debug_name;
>>
>>   	resched_name = kasprintf(GFP_KERNEL, "resched%d", cpu);
>> +	if (!resched_name)
>> +		goto fail_mem;
> 
> Would you like to add a blank line after such a statement?
Sure, I could do it in next patch.
> 
> 
>>   	per_cpu(xen_resched_irq, cpu).name = resched_name;
> …
> 
> Please compare with your subsequent suggestion.
I’ve seend a reply.
> 
> …
>> @@ -101,6 +108,9 @@ int xen_smp_intr_init(unsigned int cpu)
>>   	}
>>
>>   	callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
>> +	if (!callfunc_name)
>> +		goto fail_mem;
>> +
>>   	per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name;
> …
> 
> Regards,
> Markus
-- 
Thanks,
   Kunwu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ