Messages in this thread | | | From | Namhyung Kim <> | Subject | Re: [PATCH v3] perf tools: Fix build-id matching on vmlinux | Date | Mon, 22 Sep 2014 16:31:49 +0900 |
| |
Hi Ingo,
On Mon, 22 Sep 2014 07:16:30 +0200, Ingo Molnar wrote: > * Namhyung Kim <namhyung@kernel.org> wrote: >> + list_for_each_entry(dso, &machine->kernel_dsos, node) { >> + const char *suffix; >> + >> + suffix = dso->long_name + strlen(dso->long_name) - 3; >> + if (strcmp(suffix, ".ko")) { >> + kernel = dso; >> + break; >> + } > > Is strlen(dso->long_name) guaranteed to be >= 3? If not then you > should probably check for it, otherwise we might strcmp into > invalid memory.
I *think* they are all valid kernel modules so length should be greater than 3. But I also think that adding such an extra check won't cause any harm. So I'll change to check it in v4. :)
Thanks for your review! Namhyung
| |