Thread (6 messages) 6 messages, 2 authors, 2024-10-28

Re: [PATCH v3 1/3] kdb: Replace the use of simple_strto with safer kstrto in kdb_main

From: Doug Anderson <dianders@chromium.org>
Date: 2024-10-28 18:12:13
Also in: linux-kernel-mentees, lkml

Hi,

On Sat, Oct 26, 2024 at 7:54 AM Nir Lichtman [off-list ref] wrote:
quoted hunk ↗ jump to hunk
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help