diff mbox series

[-next] watchdog: diag288_wdt: use kmemdup() to allocate memory

Message ID 20230202074127.4108100-1-yangyingliang@huawei.com (mailing list archive)
State Changes Requested
Headers show
Series [-next] watchdog: diag288_wdt: use kmemdup() to allocate memory | expand

Commit Message

Yang Yingliang Feb. 2, 2023, 7:41 a.m. UTC
Use kmemdup() helper instead of open-coding to simplify
the code when allocating ebc_cmd.

Generated by: scripts/coccinelle/api/memdup.cocci

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/watchdog/diag288_wdt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Heiko Carstens Feb. 2, 2023, 1:22 p.m. UTC | #1
On Thu, Feb 02, 2023 at 03:41:27PM +0800, Yang Yingliang wrote:
> Use kmemdup() helper instead of open-coding to simplify
> the code when allocating ebc_cmd.
> 
> Generated by: scripts/coccinelle/api/memdup.cocci
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/watchdog/diag288_wdt.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Thanks, but this code will be changed differently with the next merge
window. Therefore I will not apply patch.
Guenter Roeck Feb. 2, 2023, 1:35 p.m. UTC | #2
On 2/2/23 05:22, Heiko Carstens wrote:
> On Thu, Feb 02, 2023 at 03:41:27PM +0800, Yang Yingliang wrote:
>> Use kmemdup() helper instead of open-coding to simplify
>> the code when allocating ebc_cmd.
>>
>> Generated by: scripts/coccinelle/api/memdup.cocci
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>   drivers/watchdog/diag288_wdt.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Thanks, but this code will be changed differently with the next merge
> window. Therefore I will not apply patch.

It looks like you decided to bypass even sending your patches to the watchdog
mailing list. I know I have not been as responsive there as I should be,
but that it no reason to bypass the maintainers completely.

Guenter
Heiko Carstens Feb. 2, 2023, 2:06 p.m. UTC | #3
On Thu, Feb 02, 2023 at 05:35:40AM -0800, Guenter Roeck wrote:
> On 2/2/23 05:22, Heiko Carstens wrote:
> > On Thu, Feb 02, 2023 at 03:41:27PM +0800, Yang Yingliang wrote:
> > > Use kmemdup() helper instead of open-coding to simplify
> > > the code when allocating ebc_cmd.
> > > 
> > > Generated by: scripts/coccinelle/api/memdup.cocci
> > > 
> > > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > > ---
> > >   drivers/watchdog/diag288_wdt.c | 3 +--
> > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > Thanks, but this code will be changed differently with the next merge
> > window. Therefore I will not apply patch.
> 
> It looks like you decided to bypass even sending your patches to the watchdog
> mailing list. I know I have not been as responsive there as I should be,
> but that it no reason to bypass the maintainers completely.

This is s390 only code which is broken. I doubt that anybody cares
about s390 specific inline assemblies.

But yes, besides that you are correct.
Guenter Roeck Feb. 2, 2023, 3:41 p.m. UTC | #4
On Thu, Feb 02, 2023 at 03:06:24PM +0100, Heiko Carstens wrote:
> On Thu, Feb 02, 2023 at 05:35:40AM -0800, Guenter Roeck wrote:
> > On 2/2/23 05:22, Heiko Carstens wrote:
> > > On Thu, Feb 02, 2023 at 03:41:27PM +0800, Yang Yingliang wrote:
> > > > Use kmemdup() helper instead of open-coding to simplify
> > > > the code when allocating ebc_cmd.
> > > > 
> > > > Generated by: scripts/coccinelle/api/memdup.cocci
> > > > 
> > > > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> > > > ---
> > > >   drivers/watchdog/diag288_wdt.c | 3 +--
> > > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > Thanks, but this code will be changed differently with the next merge
> > > window. Therefore I will not apply patch.
> > 
> > It looks like you decided to bypass even sending your patches to the watchdog
> > mailing list. I know I have not been as responsive there as I should be,
> > but that it no reason to bypass the maintainers completely.
> 
> This is s390 only code which is broken. I doubt that anybody cares
> about s390 specific inline assemblies.
> 

s/s390/<pick your platform>/g

I guess with that logic we can abolish watchdog subsystem maintenance
pretty much completely. After all, pretty much all watchdogs are
only of interest for a limited audience.

Guenter
Yang Yingliang Feb. 3, 2023, 2:40 a.m. UTC | #5
On 2023/2/2 21:35, Guenter Roeck wrote:
> On 2/2/23 05:22, Heiko Carstens wrote:
>> On Thu, Feb 02, 2023 at 03:41:27PM +0800, Yang Yingliang wrote:
>>> Use kmemdup() helper instead of open-coding to simplify
>>> the code when allocating ebc_cmd.
>>>
>>> Generated by: scripts/coccinelle/api/memdup.cocci
>>>
>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>>> ---
>>>   drivers/watchdog/diag288_wdt.c | 3 +--
>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> Thanks, but this code will be changed differently with the next merge
>> window. Therefore I will not apply patch.
>
> It looks like you decided to bypass even sending your patches to the 
> watchdog
> mailing list. I know I have not been as responsive there as I should be,
> but that it no reason to bypass the maintainers completely.
I sent the patch to all the maintainers that get by 
'./scripts/get_maintainer.pl drivers/watchdog/diag288_wdt.c'

Thanks,
Yang
>
> Guenter
>
> .
Guenter Roeck Feb. 3, 2023, 4:52 a.m. UTC | #6
On 2/2/23 18:40, Yang Yingliang wrote:
> 
> On 2023/2/2 21:35, Guenter Roeck wrote:
>> On 2/2/23 05:22, Heiko Carstens wrote:
>>> On Thu, Feb 02, 2023 at 03:41:27PM +0800, Yang Yingliang wrote:
>>>> Use kmemdup() helper instead of open-coding to simplify
>>>> the code when allocating ebc_cmd.
>>>>
>>>> Generated by: scripts/coccinelle/api/memdup.cocci
>>>>
>>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>>>> ---
>>>>   drivers/watchdog/diag288_wdt.c | 3 +--
>>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> Thanks, but this code will be changed differently with the next merge
>>> window. Therefore I will not apply patch.
>>
>> It looks like you decided to bypass even sending your patches to the watchdog
>> mailing list. I know I have not been as responsive there as I should be,
>> but that it no reason to bypass the maintainers completely.
> I sent the patch to all the maintainers that get by './scripts/get_maintainer.pl drivers/watchdog/diag288_wdt.c'
> 

I did not refer to your patch, but to Heiko's patch series
(which since has been applied to the mainline kernel).

Guenter
diff mbox series

Patch

diff --git a/drivers/watchdog/diag288_wdt.c b/drivers/watchdog/diag288_wdt.c
index 6ca5d9515d85..8c2832308284 100644
--- a/drivers/watchdog/diag288_wdt.c
+++ b/drivers/watchdog/diag288_wdt.c
@@ -273,12 +273,11 @@  static int __init diag288_init(void)
 	watchdog_set_nowayout(&wdt_dev, nowayout_info);
 
 	if (MACHINE_IS_VM) {
-		ebc_cmd = kmalloc(sizeof(ebc_begin), GFP_KERNEL);
+		ebc_cmd = kmemdup(ebc_begin, sizeof(ebc_begin), GFP_KERNEL);
 		if (!ebc_cmd) {
 			pr_err("The watchdog cannot be initialized\n");
 			return -ENOMEM;
 		}
-		memcpy(ebc_cmd, ebc_begin, sizeof(ebc_begin));
 		ret = __diag288_vm(WDT_FUNC_INIT, 15,
 				   ebc_cmd, sizeof(ebc_begin));
 		kfree(ebc_cmd);