Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-02 Thread Thomas Hellström
On Fri, 2025-05-02 at 09:49 +0200, Christian König wrote: > On 5/2/25 07:33, Al Viro wrote: > > On Thu, May 01, 2025 at 09:52:08PM -0700, Matthew Brost wrote: > > > On Fri, May 02, 2025 at 05:31:49AM +0100, Al Viro wrote: > > > > On Thu, May 01, 2025 at 09:26:25PM -0700, Matthew Brost wrote: > > >

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-02 Thread Christian König
On 5/2/25 07:33, Al Viro wrote: > On Thu, May 01, 2025 at 09:52:08PM -0700, Matthew Brost wrote: >> On Fri, May 02, 2025 at 05:31:49AM +0100, Al Viro wrote: >>> On Thu, May 01, 2025 at 09:26:25PM -0700, Matthew Brost wrote: > >>> And what is the lifecycle of that thing? E.g. what is guaranteed ab

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Al Viro
On Thu, May 01, 2025 at 09:52:08PM -0700, Matthew Brost wrote: > On Fri, May 02, 2025 at 05:31:49AM +0100, Al Viro wrote: > > On Thu, May 01, 2025 at 09:26:25PM -0700, Matthew Brost wrote: > > And what is the lifecycle of that thing? E.g. what is guaranteed about > > ttm_backup_fini() vs. functio

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Matthew Brost
On Fri, May 02, 2025 at 05:31:49AM +0100, Al Viro wrote: > On Thu, May 01, 2025 at 09:26:25PM -0700, Matthew Brost wrote: > > > I;m fairly certain is just aliasing... but I do understand a file cannot > > be embedded. Would comment help here indicating no other fields should > > be added to ttm_ba

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Al Viro
On Thu, May 01, 2025 at 09:26:25PM -0700, Matthew Brost wrote: > I;m fairly certain is just aliasing... but I do understand a file cannot > be embedded. Would comment help here indicating no other fields should > be added to ttm_backup without struct file be converted to pointer or > that just to

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Matthew Brost
On Fri, May 02, 2025 at 03:34:47AM +0100, Al Viro wrote: > On Thu, May 01, 2025 at 07:13:12PM -0700, Matthew Brost wrote: > > On Thu, May 01, 2025 at 05:24:38PM -0700, Kees Cook wrote: > > > Casting through a "void *" isn't sufficient to convince the randstruct > > > GCC plugin that the result is i

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Kees Cook
On Fri, May 02, 2025 at 03:34:47AM +0100, Al Viro wrote: > On Thu, May 01, 2025 at 07:13:12PM -0700, Matthew Brost wrote: > > On Thu, May 01, 2025 at 05:24:38PM -0700, Kees Cook wrote: > > > Casting through a "void *" isn't sufficient to convince the randstruct > > > GCC plugin that the result is i

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Al Viro
On Thu, May 01, 2025 at 07:13:12PM -0700, Matthew Brost wrote: > On Thu, May 01, 2025 at 05:24:38PM -0700, Kees Cook wrote: > > Casting through a "void *" isn't sufficient to convince the randstruct > > GCC plugin that the result is intentional. Instead operate through an > > explicit union to sile

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Kees Cook
On Thu, May 01, 2025 at 07:13:12PM -0700, Matthew Brost wrote: > On Thu, May 01, 2025 at 05:24:38PM -0700, Kees Cook wrote: > > Casting through a "void *" isn't sufficient to convince the randstruct > > GCC plugin that the result is intentional. Instead operate through an > > explicit union to sile

Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Matthew Brost
On Thu, May 01, 2025 at 05:24:38PM -0700, Kees Cook wrote: > Casting through a "void *" isn't sufficient to convince the randstruct > GCC plugin that the result is intentional. Instead operate through an > explicit union to silence the warning: > > drivers/gpu/drm/ttm/ttm_backup.c: In function 'tt

[PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

2025-05-01 Thread Kees Cook
Casting through a "void *" isn't sufficient to convince the randstruct GCC plugin that the result is intentional. Instead operate through an explicit union to silence the warning: drivers/gpu/drm/ttm/ttm_backup.c: In function 'ttm_file_to_backup': drivers/gpu/drm/ttm/ttm_backup.c:21:16: note: rand