public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Jacob Keller <jacob.e.keller@intel.com>,
	"Loktionov, Aleksandr" <aleksandr.loktionov@intel.com>,
	Jiri Pirko <jiri@resnulli.us>
Cc: Jakub Kicinski <kuba@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>,
	"horms@kernel.org" <horms@kernel.org>,
	"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [Intel-wired-lan] [PATCH net-next 1/2] devlink: unify devlink_shd_get_priv() into devlink_priv()
Date: Thu, 26 Mar 2026 06:47:52 +0100	[thread overview]
Message-ID: <4972e037-5465-4ecf-8894-e8b77f964bd2@intel.com> (raw)
In-Reply-To: <fe8ba892-e8c2-49f1-b7ef-06f4acdcc946@intel.com>


>>>
>>>   struct devlink *priv_to_devlink(void *priv) diff --git
>> I'm worried about priv_to_devlink(), if someone passes the result of devlink_priv(shared_dl) as priv,
>> container_of computes garbage - because the pointer came from shd->priv, NOT from &devlink->priv.
>>
> 
> There's no good way to detect that inside the priv_to_devlink either,
> since it can't know which private pointer it is looking at. Hmm.

We could achieve that by adding a marker prior to priv data, in the same
layout for both structs. I have code handy, will post v3 later to don't
spam too much (and hopefully resolve discussion on the other patch)

@Jiri, I will not add your RB, as this would be significant change

thanks a lot for reviewing so far to all of you

  reply	other threads:[~2026-03-26  5:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25  6:26 [PATCH net-next 0/2] devlink: shared devlink improvements Przemek Kitszel
2026-03-25  6:26 ` [PATCH net-next 1/2] devlink: unify devlink_shd_get_priv() into devlink_priv() Przemek Kitszel
2026-03-25  7:46   ` Loktionov, Aleksandr
2026-03-25 23:36     ` [Intel-wired-lan] " Jacob Keller
2026-03-26  5:47       ` Przemek Kitszel [this message]
2026-03-26  5:21   ` Jiri Pirko
2026-03-26 21:38   ` Jakub Kicinski
2026-03-25  6:26 ` [PATCH net-next 2/2] devlink: unregister shared devlink resources on destroy Przemek Kitszel
2026-03-25  7:39   ` Loktionov, Aleksandr
2026-03-26  5:20   ` Jiri Pirko
2026-03-26  5:44     ` Przemek Kitszel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4972e037-5465-4ecf-8894-e8b77f964bd2@intel.com \
    --to=przemyslaw.kitszel@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox