[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f72efa19-8f29-afcd-af07-d2ac89c9785d@linux.intel.com>
Date: Tue, 21 Mar 2023 08:43:07 +0000
From: Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>
To: Kees Cook <keescook@...omium.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc: Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] drm/i915/uapi: Replace fake flex-array with
flexible-array member
On 20/03/2023 17:36, Kees Cook wrote:
> On Fri, Mar 17, 2023 at 12:18:01PM -0600, Gustavo A. R. Silva wrote:
>> Zero-length arrays as fake flexible arrays are deprecated and we are
>> moving towards adopting C99 flexible-array members instead.
>>
>> Address the following warning found with GCC-13 and
>> -fstrict-flex-arrays=3 enabled:
>> drivers/gpu/drm/i915/gem/i915_gem_context.c: In function ‘set_proto_ctx_engines.isra’:
>> drivers/gpu/drm/i915/gem/i915_gem_context.c:769:41: warning: array subscript n is outside array bounds of ‘struct i915_engine_class_instance[0]’ [-Warray-bounds=]
>> 769 | if (copy_from_user(&ci, &user->engines[n], sizeof(ci))) {
>> | ^~~~~~~~~~~~~~~~~
>> ./include/uapi/drm/i915_drm.h:2494:43: note: while referencing ‘engines’
>> 2494 | struct i915_engine_class_instance engines[0];
>>
>> This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
>> routines on memcpy() and help us make progress towards globally
>> enabling -fstrict-flex-arrays=3 [1].
>>
>> Link: https://github.com/KSPP/linux/issues/21
>> Link: https://github.com/KSPP/linux/issues/271
>> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
>> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
>
> Reviewed-by: Kees Cook <keescook@...omium.org>
Flexible array member is even consistent with the rest of our uapi,
pushed to drm-intel-gt-next, thanks!
Regards,
Tvrtko
Powered by blists - more mailing lists