From: Paul Durrant Date: Wed, 18 May 2016 07:53:01 +0000 (+0100) Subject: xen-netback: correct length checks on hash copy_ops X-Git-Tag: v4.7-rc1~96^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f86911e2de129fb3c8ca402c251138d12c4a9d37;p=platform%2Fkernel%2Flinux-exynos.git xen-netback: correct length checks on hash copy_ops The length checks on the grant table copy_ops for setting hash key and hash mapping are checking the local 'len' value which is correct in the case of the former but not the latter. This was picked up by static analysis checks. This patch replaces checks of 'len' with 'copy_op.len' in both cases to correct the incorrect check, keep the two checks consistent, and to make it clear what the checks are for. Signed-off-by: Paul Durrant Reported-by: Dan Carpenter Cc: Wei Liu Acked-by: Wei Liu Signed-off-by: David S. Miller --- diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c index 392e392..fb87cb3 100644 --- a/drivers/net/xen-netback/hash.c +++ b/drivers/net/xen-netback/hash.c @@ -311,7 +311,7 @@ u32 xenvif_set_hash_key(struct xenvif *vif, u32 gref, u32 len) if (len > XEN_NETBK_MAX_HASH_KEY_SIZE) return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; - if (len != 0) { + if (copy_op.len != 0) { gnttab_batch_copy(©_op, 1); if (copy_op.status != GNTST_okay) @@ -359,7 +359,7 @@ u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len, if (mapping[off++] >= vif->num_queues) return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; - if (len != 0) { + if (copy_op.len != 0) { gnttab_batch_copy(©_op, 1); if (copy_op.status != GNTST_okay)