From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 328852C8 for ; Wed, 23 May 2018 14:11:01 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id j4-v6so8368972wme.1 for ; Wed, 23 May 2018 05:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JzXkc4+D7RdZY6B6hy3/DxBjc2J60urIBcf5J1yyBig=; b=cDdSK3bP8SqoxK/5N+liWW8N+3dDnmMk6XEJtWMa+Q/G14Su8lw1w8FztbWlhJ5DZX ZO8TFOyMRMsm+chb5A7tHdIixvPcqbWP2xGVyiftqxw2vwSin078GlkLFy3ISLShK9KU cBKMTYeiXWehaJ0xkmB0ysq1zMfBGds/+lzri76c1RscvEaGZGOUGDd/TfiqudRUZWhi gjTL35MeJl+py58EjgaN9haK+vOoid7UWCwGR/CGpjtXoSs1RckK+7AGtbK57HXe3I7O EvKndq1EMm+9YWKKW2mdH8/0Xc5nt6tVMy48PQM8S1/YXvEj3ezlzr7PogEigzHpXDOI UCyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JzXkc4+D7RdZY6B6hy3/DxBjc2J60urIBcf5J1yyBig=; b=N4uJfzIaZ9TUYi2DJg7HdpIVbwRIfmdq8sPMSw2Y1vHFH9R2xtwl+h2VnyYZCKfYiH 0CiqT9TLlWAUsRf7P/Jf0T3s8yNU02ZJWPb2dfq5zW24Xbprc1+TcxQHoa0EQ/XmQOU+ 3QXZZz8dyKQVmqMENDAznujiP+MJqM6FsUXhNEcEtlUjBEgUM2nyhGgN110Ee/sSyOQ+ JE6nztSFW66ttjCXmVBuTMLHpLfZ8xHSUxJZT5y0VikjMF7g3sc/TdJimLMW37JK1HB3 VSFBY12V6HkWIPys27zd/WwcolEQZA3WtkqDTc0bmXz4qTg+54RhCQqFihNsz7s7dxNP gXkg== X-Gm-Message-State: ALKqPwf3+V+wOdIK+Boa8ZS82Hk9HSdv8RA0bnfRHav9Yh7Elq9XQVZu PUWVOopwkY7Xnj3o/c3haQecAhNZHlE= X-Google-Smtp-Source: AB8JxZq0uOLIRQkQEhJBM364Akz0YOVCUAf1ev8uJR7s2uUL92YqQlzK182TCgu59tRd8cwbnuBhrg== X-Received: by 2002:a1c:180b:: with SMTP id 11-v6mr4491751wmy.21.1527077460892; Wed, 23 May 2018 05:11:00 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id b123-v6sm1858963wme.22.2018.05.23.05.10.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 05:11:00 -0700 (PDT) From: luca.boccassi@gmail.com To: Andy Green Cc: Bruce Richardson , dpdk stable Date: Wed, 23 May 2018 13:09:38 +0100 Message-Id: <20180523121010.8385-27-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180523121010.8385-1-luca.boccassi@gmail.com> References: <20180516101323.2234-2-luca.boccassi@gmail.com> <20180523121010.8385-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net: explicit cast in L4 checksum' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2018 12:11:01 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/25/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 819c4e0bdc5e6b5143e338f06019358eaf5a5e9b Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 22 May 2018 09:24:22 +0800 Subject: [PATCH] net: explicit cast in L4 checksum [ upstream commit f37a2e7c747b0758fcd8390482aeeac490f688b5 ] GCC 8.1 warned: In function 'rte_ipv4_udptcp_cksum': rte_byteorder.h:51:24: warning: conversion from 'long unsigned int' to 'uint32_t' {aka 'unsigned int'} may change value [-Wconversion] #define rte_bswap16(x) ((uint16_t) (__builtin_constant_p(x) ? \ ^ rte_byteorder.h:85:29: note: in expansion of macro 'rte_bswap16' #define rte_be_to_cpu_16(x) rte_bswap16(x) ^~~~~~~~~~~ rte_ip.h:321:11: note: in expansion of macro 'rte_be_to_cpu_16' l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - ^~~~~~~~~~~~~~~~ Also with this one, it is a cast that always occurred and is just being done explicitly, with no changes to the generated code. The warning stack is misleading, it points to the last element in the macro that produced the lhs of the subtraction above. But the only "unsigned long int" in the expression is the result of the sizeof() on the rhs, it promotes the subtraction result to unsigned long. So the error actually relates to the result of the outer subtraction. The actual error is "you are trying to put an unsigned long into a uint32_t". We always did so, the fix is just to inform the compiler it is intentional with an explicit cast. Fixes: 6006818cfb ("net: new checksum functions") Signed-off-by: Andy Green Acked-by: Bruce Richardson --- lib/librte_net/rte_ip.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index c924aca7f..72dc2456a 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -318,8 +318,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) uint32_t cksum; uint32_t l4_len; - l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr); + l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - + sizeof(struct ipv4_hdr)); cksum = rte_raw_cksum(l4_hdr, l4_len); cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0); -- 2.14.2