[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWG+cVGzWeivm43r_AaemoHk=YmQ_vc+t+B28KG27TaVg@mail.gmail.com>
Date: Wed, 13 Nov 2013 19:40:08 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Rob Herring <robherring2@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Vineet Gupta <vgupta@...opsys.com>,
James Hogan <james.hogan@...tec.com>,
Ralf Baechle <ralf@...ux-mips.org>,
Jonas Bonn <jonas@...thpole.se>,
Chris Zankel <chris@...kel.net>,
Rob Herring <rob.herring@...xeda.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
Subject: Re: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
On Wed, Nov 13, 2013 at 6:34 PM, Rob Herring <robherring2@...il.com> wrote:
>>> + if (!initial_boot_params ||
>>> + (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER))
>>> + initial_boot_params = &__dtb_start;
>>> +
>>> /* check device tree validity */
>>> - if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
>>> + if (!initial_boot_params ||
>>
>> initial_boot_params cannot be NULL here, so no need to check.
>
> What about the case of no built-in dtb like on arm?
Even then the symbol exists, as all architectures put INIT_DATA or
INIT_DATA_SECTION in their vmlinux.lds.S.
But the section will be empty, cfr. the case __dtb_end == __dtb_start below.
>>
>>> + (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER)) {
>>
>> However, if __dtb_end == __dtb_start, you may be reading random
>> data here from the next section. The OF_DT_HEADER check should cover
>> this, but better safe than sorry?
>
> Then we should also check that (__dtb_end != __dtb_start).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists