[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfuBxyera+QsjgH95Qm1bAzUY0PivwvO7Pg1-oUQ5esj+dZ=A@mail.gmail.com>
Date: Tue, 21 May 2024 08:41:45 -0600
From: jim.cromie@...il.com
To: Łukasz Bartosik <ukaszb@...omium.org>
Cc: jbaron@...mai.com, gregkh@...uxfoundation.org,
linux-kernel@...r.kernel.org, linux@...musvillemoes.dk, joe@...ches.com,
mcgrof@...nel.org, daniel.vetter@...ll.ch, tvrtko.ursulin@...ux.intel.com,
jani.nikula@...el.com, ville.syrjala@...ux.intel.com, seanpaul@...omium.org,
robdclark@...il.com, groeck@...gle.com, yanivt@...gle.com, bleung@...gle.com
Subject: Re: [PATCH v8-RESEND 04/33] dyndbg: make ddebug_class_param union
members same size
On Tue, May 21, 2024 at 5:42 AM Łukasz Bartosik <ukaszb@...omium.org> wrote:
>
> On Thu, May 16, 2024 at 7:44 PM Jim Cromie <jim.cromie@...il.com> wrote:
> >
> > struct ddebug_class_param keeps a ref to the state-storage of the
> > param; make both class-types use the same unsigned long storage type.
> > ISTM this is simpler and safer.
>
> Why is it safer for members of a union to have the same size ?
>
Its mostly extra paranoia.
but if 2 users somehow get the class-type mixed up,
at least theres no alignment issue added into it.
And a problem like this would naturally happen (murphys law)
when the PARAM_REF macro is used, which uses/shares the existing storage,
so that existing code can use that storage.
For example, DRM uses PARAM_REF so it can continue to use __drm_debug
for a few spots in code that still examine the value during normal operations.
I'll reword the commit msg to say that more clearly (than this?)
Powered by blists - more mailing lists