From patchwork Thu Dec 3 22:26:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 336948 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp671770ilb; Thu, 3 Dec 2020 14:28:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVkdayksqN5pDCfIIBeGtWZbFrk9CXL7E6uqMdG1PZGR8FyPQByV8imZB1GRuf1WXySIfy X-Received: by 2002:a17:906:e086:: with SMTP id gh6mr4342831ejb.95.1607034487244; Thu, 03 Dec 2020 14:28:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607034487; cv=none; d=google.com; s=arc-20160816; b=L8bjJH6uQFLnokkvQ1BDTzinI2yF9Tm7gSXaLIm2/qVxTkpqxwO0CUf4iYCrLjpPYF Jxxi0m3ORm+1cezBcCunDp7j9gUWmUmjBHHM7g/j76q9yB9cNLYLHW8VhKqT08aLuNBP wWtne9ugU5HkuEEL/qTTIn0jKo1yeohtIXB32/14ZzvdDReC2iV9ujNBrfLUr9Mlnp8Z QQRBudzUBdZignogayqRQ0ppBIgKAeqXqUigub1hPwjnaJklHGs6r2SILPDU4GYm6Yvs nmJviAOTYNAsljNlN0zohEbzqYAjJWrQNaTsXP/cDl5llUXM6XhdlF+b2hIDuhtF9/vt fVqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=BT5uX2dtcBynslKEM6J0+40qpRnQceZd2wNxFfAiEEE=; b=d43yRDQJ+A0gkpkVVNnRJzpXLFrqrSQJnm2RZUnzO0WkSyJENuAF8LVhwwvO3cJMEG aA8oz0NxBEGqc4kAiDe7qplFX4sMWthzesQ5ELxnoHMzKa8AuSYgRrG7wgwTjPBkGuP5 QG7g97mSKRMxbVwDCPynJn6Am2K3RaYI4yYK/MoNZBZz7030kqRdxOxPeNoHfJLJXQEZ 3usB5NKg8P8KzTxJL0katmyF3jLI7UEpsXA79cHmO2J9nJ9QsrtnUpEjbXGChhJH11KA RMLaZcF1rDBTrf6mM5D+jOYrzM2vB929bOpivT8+v+DvQ6lXZKow2srUjAMpIjGO/oPH /ytg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u17si1741540edt.394.2020.12.03.14.28.07; Thu, 03 Dec 2020 14:28:07 -0800 (PST) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387577AbgLCW11 (ORCPT + 8 others); Thu, 3 Dec 2020 17:27:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:53454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726931AbgLCW11 (ORCPT ); Thu, 3 Dec 2020 17:27:27 -0500 From: Arnd Bergmann Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" , Jakub Kicinski Cc: Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , YueHaibing , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] ch_ktls: fix build warning for ipv4-only config Date: Thu, 3 Dec 2020 23:26:16 +0100 Message-Id: <20201203222641.964234-1-arnd@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann When CONFIG_IPV6 is disabled, clang complains that a variable is uninitialized for non-IPv4 data: drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1046:6: error: variable 'cntrl1' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (tx_info->ip_family == AF_INET) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1059:2: note: uninitialized use occurs here cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) | ^~~~~~ Replace the preprocessor conditional with the corresponding C version, and make the ipv4 case unconditional in this configuration to improve readability and avoid the warning. Fixes: 86716b51d14f ("ch_ktls: Update cheksum information") Signed-off-by: Arnd Bergmann --- .../net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.27.0 diff --git a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c index 7f90b828d159..1b7e8c91b541 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c @@ -987,9 +987,7 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb, struct fw_eth_tx_pkt_wr *wr; struct cpl_tx_pkt_core *cpl; u32 ctrl, iplen, maclen; -#if IS_ENABLED(CONFIG_IPV6) struct ipv6hdr *ip6; -#endif unsigned int ndesc; struct tcphdr *tcp; int len16, pktlen; @@ -1043,17 +1041,15 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb, cpl->len = htons(pktlen); memcpy(buf, skb->data, pktlen); - if (tx_info->ip_family == AF_INET) { + if (!IS_ENABLED(CONFIG_IPV6) || tx_info->ip_family == AF_INET) { /* we need to correct ip header len */ ip = (struct iphdr *)(buf + maclen); ip->tot_len = htons(pktlen - maclen); cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP); -#if IS_ENABLED(CONFIG_IPV6) } else { ip6 = (struct ipv6hdr *)(buf + maclen); ip6->payload_len = htons(pktlen - maclen - iplen); cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP6); -#endif } cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |