From: Marek Vasut <marex@denx.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
linux-can@vger.kernel.org,
Wolfgang Grandegger <wg@grandegger.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH] can: Use correct type in sizeof() in nla_put()
Date: Fri, 30 Oct 2015 16:33:11 +0100 [thread overview]
Message-ID: <201510301633.11762.marex@denx.de> (raw)
In-Reply-To: <5633846B.30107@hartkopp.net>
On Friday, October 30, 2015 at 03:53:31 PM, Oliver Hartkopp wrote:
> On 10/30/2015 03:24 PM, Marek Vasut wrote:
> > On Friday, October 30, 2015 at 03:17:44 PM, Marc Kleine-Budde wrote:
> >> On 10/30/2015 03:01 PM, Marek Vasut wrote:
> >>> Are you absolutelly positive this doesn't break kernel ABI please ?
> >>>
> >>> I am a little worried there, since the size of can_clock and
> >>> can_ctrlmode structures differ.
> >>
> >> struct can_clock is a u32, see [1]
> >> struct can_ctrlmode is 2 x u32.
> >>
> >> in libsocketcan[2] it's accessed like this:
> >>> memcpy(res,
> >>>
> >>> RTA_DATA(can_attr[IFLA_CAN_CLOCK]),
> >>> sizeof(struct can_clock));
> >>
> >> I think it should be ok.
> >
> > In that case, yes, it's good. Hopefully, noone wrote his own thing.
>
> Fortunately ip from iproute2 does it similary:
>
> https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/i
> p/iplink_can.c#n338
>
>
> if (tb[IFLA_CAN_CLOCK]) {
> struct can_clock *clock = RTA_DATA(tb[IFLA_CAN_CLOCK]);
>
> fprintf(f, "\n clock %d", clock->freq);
> }
>
> As the clock is a read-only value kernel->userspace and nla_put creates its
> own small ID/length information each time we are REALLY LUCKY that this fix
> doesn't break the ABI in this case.
>
> When can_clock would have been greater then can_ctrlmode we really had a
> problem ...
>
> Thanks for caching this!
Yeah, I already had one leg in my asbestos trousers all right. Thanks for
double-checking this!
Best regards,
Marek Vasut
next prev parent reply other threads:[~2015-10-30 15:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-30 12:48 [PATCH] can: Use correct type in sizeof() in nla_put() Marek Vasut
2015-10-30 13:40 ` Marc Kleine-Budde
2015-10-30 14:01 ` Marek Vasut
2015-10-30 14:17 ` Marc Kleine-Budde
2015-10-30 14:24 ` Marek Vasut
2015-10-30 14:53 ` Oliver Hartkopp
2015-10-30 15:33 ` Marek Vasut [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-10-30 13:39 pull-request: can 2015-10-30 Marc Kleine-Budde
2015-10-30 13:39 ` [PATCH] can: Use correct type in sizeof() in nla_put() Marc Kleine-Budde
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=201510301633.11762.marex@denx.de \
--to=marex@denx.de \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=socketcan@hartkopp.net \
--cc=wg@grandegger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.