Re: [PATCH] libata-eh: Use switch() instead of sparse array for protocol strings

From: Tejun Heo
Date: Mon Jan 09 2017 - 15:32:35 EST


Hello,

On Mon, Jan 09, 2017 at 09:28:12PM +0100, Geert Uytterhoeven wrote:
> > So, to avoid that, we can just kmalloc and kfree the buffer, but it
> > seems like a silly complication to work around bugs in some
> > bootloaders. There are many places in kernel where we're liberal
> > about __initdata which is great. I'm not sure complicating all those
> > places for a broken bootloader is a good idea.
>
> Sure. We cannot avoid that kernels (esp. multiplatform) keep on growing.
>
> But when I see a new 4KiB-sized buffer, i'm always suspicious...
> A few years ago, I caught someone miscalculating shifts, leading
> to a static buffer that was 256 times larger than intended ;-)

Oh, sure, things like the protocol string table are just stupid and
it's great that you caught it. I just don't think it makes sense to
scrutinize bss __initdata. It's not in kernel image and goes away
once the kernel boots. It's okay to a bit liberal with them for the
sake of simplicity.

Thanks.

--
tejun