All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Bennett Amodio <bamodio@purestorage.com>, linux-nfs@vger.kernel.org
Cc: anna.schumaker@netapp.com, trond.myklebust@primarydata.com,
	Igor Ostrovsky <igor@purestorage.com>,
	Vas Chellappa <vas@purestorage.com>,
	Jui-Yu Chang <juchang@purestorage.com>
Subject: Re: [RFC v3 2/2] SUNRPC: Mask XIDs to prevent replay cache collision
Date: Thu, 17 Aug 2017 13:23:58 +1000	[thread overview]
Message-ID: <87pobunagh.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <CAKk7tABaTxA102tUHEuYyC8rtbNDjzHX6MdVcCkTy_26yfVkvA@mail.gmail.com>

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

On Tue, Aug 15 2017, Bennett Amodio wrote:

> + xprt->xid_mask = 0xffffffff >> args->bitmask_len;
> + xprt->masked_id = args->transport_id << (32 - args->bitmask_len);

hi,
 the above isn't safe when bitmask_len is zero.
 Shifting a u32 32 bits to the left is undefined in C.

        The result is undefined if the right operand is negative, or
        greater than or equal to the number of bits in the left
        expression’s type.

 if (args->bitmask_len)
	xprt->masked_id = args->transport_id << (32 - args->bitmask_len);
 else
        xprt->masked_id = 0;

Thanks,
NeilBrown

> + xprt->xid = args->init_xid;
> +

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-08-17  3:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16  0:51 [RFC v3 2/2] SUNRPC: Mask XIDs to prevent replay cache collision Bennett Amodio
2017-08-17  3:23 ` NeilBrown [this message]
2017-08-17  3:33 ` NeilBrown

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=87pobunagh.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=anna.schumaker@netapp.com \
    --cc=bamodio@purestorage.com \
    --cc=igor@purestorage.com \
    --cc=juchang@purestorage.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    --cc=vas@purestorage.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.