public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: jonghwa3.lee@samsung.com, linux-pm@vger.kernel.org
Subject: Re: max17042_battery: Support regmap to access device's registers
Date: Mon, 17 Aug 2015 17:08:54 +0300	[thread overview]
Message-ID: <20150817140854.GB5610@mwanda> (raw)
In-Reply-To: <CAJKOXPcjs+=gdzUUhkoYaOfnyWOFCfgg=XqKenK7GC46KBV-fw@mail.gmail.com>

The static checker is just complaining about the cast...  I have looked
at it again and this code is definitely buggy.

max17042_read_model_data() reads u32s into tmp_data.
->cell_char_tbl is an array with 48 elements of u16.

We later assume that cell_char_tbl and temp_data have 48 bytes each when
we use memcmp() to compare them.  This only compares the first half of
->cell_char_tbl with the first quarter of tmp_data[].

Then we assume that they hold u16s when we print out the warning
message.

regards,
dan carpetner


      reply	other threads:[~2015-08-17 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14  9:55 max17042_battery: Support regmap to access device's registers Dan Carpenter
2015-08-17  5:26 ` Krzysztof Kozlowski
2015-08-17 14:08   ` Dan Carpenter [this message]

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=20150817140854.GB5610@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=jonghwa3.lee@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-pm@vger.kernel.org \
    /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