From: David Laight <David.Laight@ACULAB.COM>
To: 'Guru Mehar Rachaputi' <gurumeharrachaputi@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] staging: pi433: modify bit_rate from u16 to u32
Date: Wed, 1 Feb 2023 12:34:50 +0000 [thread overview]
Message-ID: <19e492521b4a4d31aa13c45e8616689b@AcuMS.aculab.com> (raw)
In-Reply-To: <Y9jrOKMGl7ITKxhP@combine-ThinkPad-S1-Yoga>
From: Guru Mehar Rachaputi
> Sent: 31 January 2023 10:20
...
> > > struct pi433_tx_cfg {
> > > __u32 frequency;
> > > - __u16 bit_rate;
> > > + __u32 bit_rate;
> > > __u32 dev_frequency;
> > > enum modulation modulation;
> > > enum mod_shaping mod_shaping;
> >
> > And didn't you just break existing userspace code? If not, how? If so,
> > how did you test this?
> >
> My apologies, I did not study code. While testing, the probe function of
> pi433 driver didn't appear in the lsmod operation. I suspected my
> testing was wrong.
You don't need to study any code, just the structure you changed.
On all architectures (except m68k) there is a two byte pad
after the bit_rate field, this is likely to be filled with
random data from the applications stack.
On little-endian architectures the low byte is in the same place,
so if the 'random data' is zero it will happen to work.
However, on big-endian architectures, the low byte moves so
the value passed (by old applications) will always be wrong.
In reality having a uapi structure with embedded padding should
be banned.
But that would need a compiler attribute to enforce it.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2023-02-01 12:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 2:11 Guru Mehar Rachaputi
2023-01-31 5:22 ` Greg Kroah-Hartman
2023-01-31 10:19 ` Guru Mehar Rachaputi
2023-01-31 10:41 ` Greg Kroah-Hartman
2023-01-31 10:52 ` Guru Mehar Rachaputi
2023-01-31 11:14 ` Dan Carpenter
2023-01-31 18:18 ` Guru Mehar Rachaputi
2023-02-01 12:34 ` David Laight [this message]
2023-02-01 13:22 ` Dan Carpenter
2023-02-02 22:02 ` David Laight
2023-02-02 22:13 ` Dan Carpenter
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=19e492521b4a4d31aa13c45e8616689b@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=gregkh@linuxfoundation.org \
--cc=gurumeharrachaputi@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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
all inboxes | Powered by JetHome®