From: David Howells <dhowells@redhat.com>
To: Ayush Mittal <ayush.m@samsung.com>
Cc: dhowells@redhat.com, aryabinin@virtuozzo.com,
james.l.morris@oracle.com, linux-kernel@vger.kernel.org,
v.narang@samsung.com, a.sahrawat@samsung.com,
pankaj.m@samsung.com
Subject: Re: [PATCH 1/1] mpi: check for shift exponent greater than 31.
Date: Wed, 01 Nov 2017 14:10:21 +0000 [thread overview]
Message-ID: <9150.1509545421@warthog.procyon.org.uk> (raw)
In-Reply-To: <1508822823-31231-1-git-send-email-ayush.m@samsung.com>
Ayush Mittal <ayush.m@samsung.com> wrote:
> This patch check for shift exponent greater than 31,
Firstly, isn't it 63 on 64-bit machines?
Secondly, this is the wrong way to do things. The banner comment on
mpihelp_lshift(), for example, says that the function has the following
argument constraints:
0 < CNT < BITS_PER_MP_LIMB
so sh1 and sh2 must both be in the range 1-31 or 1-63, assuming cnt is
within its constraints.
Therefore if it needs a checking, you only need to check cnt on entry to the
function, rather than checking sh1 and sh2 inside the loop. Further, you
should use pr_err() so that we know that this has gone wrong and return an
error to the caller (there are security implications).
Further, have you checked the caller to see if they do ever violate the
constraints?
It looks like you're adding fixes for your test, not for the code.
David
next prev parent reply other threads:[~2017-11-01 14:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20171024052942epcas5p48384a3861fbfa90a37a03236828b9b67@epcas5p4.samsung.com>
2017-10-24 5:27 ` Ayush Mittal
[not found] ` <CGME20171024052942epcas5p48384a3861fbfa90a37a03236828b9b67@epcms5p6>
2017-11-09 14:55 ` Vaneet Narang
2017-11-01 14:10 ` David Howells [this message]
[not found] <CGME20171012110658epcas5p14bf46cbbca920da1577ab0d58f06ad67@epcas5p1.samsung.com>
2017-10-12 11:04 ` Ayush Mittal
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=9150.1509545421@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=a.sahrawat@samsung.com \
--cc=aryabinin@virtuozzo.com \
--cc=ayush.m@samsung.com \
--cc=james.l.morris@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pankaj.m@samsung.com \
--cc=v.narang@samsung.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 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®