Re: [PATCH v3 1/3] kdb: Replace the use of simple_strto with safer kstrto in kdb_main
From: Doug Anderson
Date: Mon Oct 28 2024 - 14:12:51 EST
Hi,
On Sat, Oct 26, 2024 at 7:54 AM Nir Lichtman <nir@xxxxxxxxxxxx> wrote:
>
> @@ -2083,15 +2064,10 @@ static int kdb_dmesg(int argc, const char **argv)
> if (argc > 2)
> return KDB_ARGCOUNT;
> if (argc) {
> - char *cp;
> - lines = simple_strtol(argv[1], &cp, 0);
> - if (*cp)
> + if (kstrtoint(argv[1], 0, &lines))
> lines = 0;
> - if (argc > 1) {
> - adjust = simple_strtoul(argv[2], &cp, 0);
> - if (*cp || adjust < 0)
> - adjust = 0;
> - }
> + if (argc > 1 && (kstrtouint(argv[2], 0, &adjust) || adjust < 0))
Between v2 and v3 you regressed. The kstrtouint() was supposed to be
changed to kstrtoint() here.
-Doug