linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: luc.vanoostenryck@gmail.com (Luc Van Oostenryck)
To: linux-security-module@vger.kernel.org
Subject: [PATCH] tpm: fix byte order related arithmetic inconsistency in tpm_getcap()
Date: Thu, 11 May 2017 01:41:15 +0200	[thread overview]
Message-ID: <CAExDi1RODELLA+N4_5JS3LcDa5DN4q_imYwhw4hd4BHq1GFRBw@mail.gmail.com> (raw)
In-Reply-To: <20170510123458.fh3ef3c55y2wiu35@intel.com>

On Wed, May 10, 2017 at 2:34 PM, Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:

> Arithmetic should work but it's not a good practice to do additions,
> substractions or multiplications in any other byte order than the CPU
> byte order.
>
> sparse also complains about this.
>
> /Jarkko

Arithmetic should work?
let's try with 0x0080:
in native order: 0x0080 + 0x0080 = 0x0100
in reverse order: 0x8000 + 0x8000 = 0x0000 != swap16(0x0100)

Or do I misunderstand what you mean by "arithmetic should work"?

-- Luc Van Oostenryck
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-05-10 23:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-07 17:50 [PATCH] tpm: fix byte order related arithmetic inconsistency in tpm_getcap() Jarkko Sakkinen
2017-05-09 14:13 ` Jarkko Sakkinen
2017-05-09 15:13   ` Jason Gunthorpe
2017-05-10 12:34     ` Jarkko Sakkinen
2017-05-10 23:41       ` Luc Van Oostenryck [this message]
2017-05-11 10:16         ` Jarkko Sakkinen
2017-05-15 11:36       ` [tpmdd-devel] " Jarkko Sakkinen
2017-05-15 15:39         ` Jason Gunthorpe
2017-05-24 16:59           ` Jarkko Sakkinen

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=CAExDi1RODELLA+N4_5JS3LcDa5DN4q_imYwhw4hd4BHq1GFRBw@mail.gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-security-module@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;
as well as URLs for NNTP newsgroup(s).