950-0284-watchdog-bcm2835-Ignore-params-after-the-partition-n.patch 964 B

1234567891011121314151617181920212223242526272829
  1. From e26bdd060e7881989a553a1087b7c1e4227f3986 Mon Sep 17 00:00:00 2001
  2. From: Tim Gover <[email protected]>
  3. Date: Thu, 22 Oct 2020 15:30:55 +0100
  4. Subject: [PATCH] watchdog: bcm2835: Ignore params after the partition
  5. number
  6. Use sscanf to extract the partition number and ignore extra parameters
  7. which are only relevant to other reboot notifiers.
  8. ---
  9. drivers/watchdog/bcm2835_wdt.c | 6 ++++--
  10. 1 file changed, 4 insertions(+), 2 deletions(-)
  11. --- a/drivers/watchdog/bcm2835_wdt.c
  12. +++ b/drivers/watchdog/bcm2835_wdt.c
  13. @@ -127,10 +127,12 @@ static int bcm2835_restart(struct watchd
  14. {
  15. struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
  16. - unsigned long long val;
  17. + unsigned long val;
  18. u8 partition = 0;
  19. - if (data && !kstrtoull(data, 0, &val) && val <= 63)
  20. + // Allow extra arguments separated by spaces after
  21. + // the partition number.
  22. + if (data && sscanf(data, "%lu", &val) && val < 63)
  23. partition = val;
  24. __bcm2835_restart(wdt, partition);