Re: [RFC v3 2/2] SUNRPC: Mask XIDs to prevent replay cache collision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux