[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgiPxF6GnvaSGV+xOjcBO-T1vxLYhSvho0Q5Cdqw7t74w@mail.gmail.com>
Date: Thu, 9 Nov 2023 16:51:39 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: imre.deak@...el.com
Cc: David Laight <David.Laight@...lab.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Build fail in drivers/gpu/drm/i915/display/intel_tc.c
On Thu, 9 Nov 2023 at 15:34, Imre Deak <imre.deak@...el.com> wrote:
>
> The compiler warn should be fixed/suppressed by:
> https://lore.kernel.org/all/20231026125636.5080-1-nirmoy.das@intel.com
Ugh, so now it's a dynamic allocation, wasting memory, and a pointer
to it, using as much memory as the array did in the first place.
All because of a pointless warning that was a false positive - and was
always harmless anyway, since snprintf() is safe (ie it was only a
"might be truncated").
Please don't do this. Either do that ((tc_port & 7) + 1) suggestion of
David's, or just do '%c' and make the expression be
'1' + tc_port
which should be fine since I915_MAX_PORTS is 8 or whatever.
I do wonder why those ports are printed out as '1-8', when the 'enum
port' is PORT_A..I.
So it would actually have made more sense to print them out as %c with
the expression being
'A'+tc_port
but I guess by now people might depend on the 1..8 naming?
Linus
Powered by blists - more mailing lists