Re: [PATCH v3] perf tools: Fix build-id matching on vmlinux

From: Namhyung Kim
Date: Mon Sep 22 2014 - 03:31:58 EST


Hi Ingo,

On Mon, 22 Sep 2014 07:16:30 +0200, Ingo Molnar wrote:
> * Namhyung Kim <namhyung@xxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/