Skip to contentSkip to conversation

watchdog: diag288_wdt: use kmemdup() to allocate memory

PATCH In review Yang Yingliang 3 participants 7 messages Feb 2, 2023 – Feb 3, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: diag288_wdt: use kmemdup() to allocate memory

Use kmemdup() helper instead of open-coding to simplify the code when allocating ebc_cmd.

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

---
 drivers/watchdog/diag288_wdt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/watchdog/diag288_wdt.c +1 -2
index 6ca5d9515d85..8c2832308284 100644
@@ -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);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 9 lines · Yang Yingliang

Use kmemdup() helper instead of open-coding to simplify the code when allocating ebc_cmd.

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

---
 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.

maintainer
#2 lore raw
Quoted 6 lines · Heiko Carstens
Quoted 5 lines · Yang Yingliang

Use kmemdup() helper instead of open-coding to simplify the code when allocating ebc_cmd.

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

Quoted 7 lines
Quoted 4 lines
---
  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

maintainer
#3 lore raw
Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Heiko Carstens
Quoted 9 lines · Yang Yingliang

Use kmemdup() helper instead of open-coding to simplify the code when allocating ebc_cmd.

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

---
  drivers/watchdog/diag288_wdt.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 6 lines
Quoted 2 lines

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.

maintainer
#4 lore raw
Quoted 16 lines · Heiko Carstens
Quoted 15 lines · Guenter Roeck
Quoted 13 lines · Heiko Carstens
Quoted 9 lines · Yang Yingliang

Use kmemdup() helper instead of open-coding to simplify the code when allocating ebc_cmd.

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

---
  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.

Quoted 7 lines
Quoted 3 lines

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

#5 lore raw
In reply to Guenter Roeck
Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Heiko Carstens
Quoted 9 lines · Yang Yingliang

Use kmemdup() helper instead of open-coding to simplify the code when allocating ebc_cmd.

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

---
  drivers/watchdog/diag288_wdt.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 6 lines
Quoted 2 lines

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

Quoted 4 lines

Guenter

.

maintainer
#6 lore raw
Quoted 14 lines · Yang Yingliang
Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Heiko Carstens
Quoted 9 lines · Yang Yingliang

Use kmemdup() helper instead of open-coding to simplify the code when allocating ebc_cmd.

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

---
  drivers/watchdog/diag288_wdt.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

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