From: "Sa, Nuno" <Nuno.Sa@analog.com>
To: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>,
"colin.king@canonical.com" <colin.king@canonical.com>,
"knaack.h@gmx.de" <knaack.h@gmx.de>,
"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
"lars@metafoo.de" <lars@metafoo.de>
Cc: "kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: temperature: ltc2983: fix u32 read into a unsigned long long
Date: Wed, 6 Nov 2019 14:19:52 +0000 [thread overview]
Message-ID: <dab9cfd93e6affa5d94f078154c3e181303bbf47.camel@analog.com> (raw)
In-Reply-To: <20191105202818.90065-1-colin.king@canonical.com>
On Tue, 2019-11-05 at 20:28 +0000, Colin King wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the read of temp using of_property_read_u32_index is
> reading
> a u32 value into a unsigned long long. This relies on machine
> endianness
> to work correctly, so fix this by reading a u32 value and setting
> temp
> to this value.
>
> Addresses-Coverity: ("Reliance on integer endianness")
> Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/iio/temperature/ltc2983.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/temperature/ltc2983.c
> b/drivers/iio/temperature/ltc2983.c
> index ddf47023364b..d39c0d6b77f1 100644
> --- a/drivers/iio/temperature/ltc2983.c
> +++ b/drivers/iio/temperature/ltc2983.c
> @@ -444,8 +444,10 @@ static struct ltc2983_custom_sensor
> *__ltc2983_custom_sensor_new(
> else
> temp = __convert_to_raw(temp,
> resolution);
> } else {
> - of_property_read_u32_index(np, propname, index,
> - (u32 *)&temp);
> + u32 t32;
> +
> + of_property_read_u32_index(np, propname, index,
> &t32);
> + temp = t32;
> }
>
> for (j = 0; j < n_size; j++)
Acked-by: Nuno Sá <nuno.sa@analog.com>
Thanks,
Nuno Sá
next prev parent reply other threads:[~2019-11-06 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 20:28 [PATCH] iio: temperature: ltc2983: fix u32 read into a unsigned long long Colin King
2019-11-06 14:19 ` Sa, Nuno [this message]
2019-11-10 11:48 ` Jonathan Cameron
2019-11-16 15:15 ` Jonathan Cameron
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=dab9cfd93e6affa5d94f078154c3e181303bbf47.camel@analog.com \
--to=nuno.sa@analog.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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