All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Derrick, Jonathan" <jonathan.derrick@intel.com>
To: "Bauer, Scott" <scott.bauer@intel.com>,
	"jonas.rabenstein@studium.uni-erlangen.de"
	<jonas.rabenstein@studium.uni-erlangen.de>,
	"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH][RESEND] block: sed-opal: fix u64 short atom length
Date: Tue, 6 Mar 2018 23:45:14 +0000	[thread overview]
Message-ID: <1520379912.4178.83.camel@intel.com> (raw)
In-Reply-To: <20180301132700.1279-1-jonas.rabenstein@studium.uni-erlangen.de>

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

Hi Jonas,

On Thu, 2018-03-01 at 14:27 +0100, Jonas Rabenstein wrote:
> The length must be given as bytes and not as 4 bit tuples.
> 
> Signed-off-by: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlange
> n.de>
> ---
>  block/sed-opal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/sed-opal.c b/block/sed-opal.c
> index 36842bfa572e..d5f565e1557a 100644
> --- a/block/sed-opal.c
> +++ b/block/sed-opal.c
> @@ -562,7 +562,7 @@ static void add_token_u64(int *err, struct
> opal_dev *cmd, u64 number)
>  	}
>  
>  	msb = fls(number);
> -	len = DIV_ROUND_UP(msb, 4);
> +	len = DIV_ROUND_UP(msb, 8);

This change looks partially correct, but I believe we should be doing
fls64() on 'number' as well.

It looks like it currently coincidentally works with u64 numbers
falling in 32-bit ranges.


>  
>  	if (cmd->pos >= IO_BUFFER_LENGTH - len - 1) {
>  		pr_debug("Error adding u64: end of buffer.\n");

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3278 bytes --]

  reply	other threads:[~2018-03-06 23:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01 13:27 [PATCH][RESEND] block: sed-opal: fix u64 short atom length Jonas Rabenstein
2018-03-06 23:45 ` Derrick, Jonathan [this message]
2018-03-07 16:55   ` [PATCH v2] " Jonas Rabenstein
2018-03-07 23:24     ` Scott Bauer
2018-03-07 23:58       ` Jonas Rabenstein
2018-03-16 15:38     ` Scott Bauer
2018-03-16 16:14       ` Jens Axboe

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=1520379912.4178.83.camel@intel.com \
    --to=jonathan.derrick@intel.com \
    --cc=axboe@kernel.dk \
    --cc=jonas.rabenstein@studium.uni-erlangen.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scott.bauer@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.