Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5981927ybc; Wed, 27 Nov 2019 12:51:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwW8yZFUX4PeVUGwFf0xpuVFb4IbJ3H/+Dhrtj5RiLhAMKHPzDX/cKT7lslxcf+jZoAN3Ug X-Received: by 2002:a05:6402:1a45:: with SMTP id bf5mr4011637edb.265.1574887888572; Wed, 27 Nov 2019 12:51:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574887888; cv=none; d=google.com; s=arc-20160816; b=oN+Kq2zqJkYogHO4QroUMlYgmvRrV+phKtJRycQx5riHvHrMTdKgC9Mc7V0AoVJ6Gh eHk0PjFHJh8Rr6QKVq4/BintdfUnr1Nkfft55tjLSCDv4+uTdM6x4MPKMJ6Z2ObWkC42 zLaT5hHCQw/Fs6nAqCA3DRp8JEfsk2Ck8+c7UtKCjh7mXzQVMIb0IIAh7o3njEPkqDT2 yyCzpd5wpQPZ9R3OgM1Q5iOldsgh+AetGhF1RsDbdN+t+r43mL6lLLrq6EhrMHvd+h4C WrBGnw+HqQIGd/5DW2MPCNUZP/5tBOKeUjH2heUof8kuBPQzrLkKlJ1m+TATU2IMmaLq mQQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PtrKFdhkm26FdGXaXCBRyleBdh207UPQYrIGiJ4XiWY=; b=QYhqtRht/CJv9dB/QNdpEg6rW6RX5KIlU8Dx+OthZzrxNQwPkh1fQkQwYuHsuDiItJ M8BiA+fooMAXYTnii9nWXvY8Aunnl0XjVSSmebWxFaz4WXcNWSDjGzVlnZU5fYkqHwHo 5yZea3S+7N+FVOd87vS6DJnNoJi9a2jJzNNIHtMmiXxVV/7gjDX4kFPBXvPkveVLNPdA 5ByQ0GJIQv+ZJ6KyHy+W70PJljnftR8KpMZD+CE/1OC8hqUXxk5e0zoErqSvwGvXpY25 FuuGbswz0ebZy+7iqflW9dMHx9NkkFBWMeGkiht38Ns4SuqOqC2nacuyI+TavSkJO+QY Tuxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DEq+fCQO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d18si9859762ejr.423.2019.11.27.12.51.04; Wed, 27 Nov 2019 12:51:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DEq+fCQO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729591AbfK0UtF (ORCPT + 99 others); Wed, 27 Nov 2019 15:49:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:34456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729258AbfK0UtB (ORCPT ); Wed, 27 Nov 2019 15:49:01 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 49F2B21787; Wed, 27 Nov 2019 20:49:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887740; bh=Hs8kuq+LuqdHAW51q4eCyncbYgnnsO9Gp6+sHsLNfl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEq+fCQOp832RzZ2da/+XPgF65pDSLrSmfF+LXpcqZjRMNP4wGY0IAJugeuAhQC0i UJiH31g3k3Pc5Gi6rsqOwhweLOVP3luvUvA/RVWo7kvmqc6G72F2dJtr2GVqtWyELB HKoeCR9PVouyAgZSu1xIZKN2JqswnYqkCM1Cn3uU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Gilad Ben-Yossef , Nick Desaulniers , Herbert Xu , Sasha Levin Subject: [PATCH 4.14 049/211] crypto: ccree - avoid implicit enum conversion Date: Wed, 27 Nov 2019 21:29:42 +0100 Message-Id: <20191127203058.669455776@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203049.431810767@linuxfoundation.org> References: <20191127203049.431810767@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit 18e732b8035d175181aae2ded127994cb01694f7 ] Clang warns when one enumerated type is implicitly converted to another and this happens in several locations in this driver, ultimately related to the set_cipher_{mode,config0} functions. set_cipher_mode expects a mode of type drv_cipher_mode and set_cipher_config0 expects a mode of type drv_crypto_direction. drivers/crypto/ccree/cc_ivgen.c:58:35: warning: implicit conversion from enumeration type 'enum cc_desc_direction' to different enumeration type 'enum drv_crypto_direction' [-Wenum-conversion] set_cipher_config0(&iv_seq[idx], DESC_DIRECTION_ENCRYPT_ENCRYPT); drivers/crypto/ccree/cc_hash.c:99:28: warning: implicit conversion from enumeration type 'enum cc_hash_conf_pad' to different enumeration type 'enum drv_crypto_direction' [-Wenum-conversion] set_cipher_config0(desc, HASH_DIGEST_RESULT_LITTLE_ENDIAN); drivers/crypto/ccree/cc_aead.c:1643:30: warning: implicit conversion from enumeration type 'enum drv_hash_hw_mode' to different enumeration type 'enum drv_cipher_mode' [-Wenum-conversion] set_cipher_mode(&desc[idx], DRV_HASH_HW_GHASH); Since this fundamentally isn't a problem because these values just represent simple integers for a shift operation, make it clear to Clang that this is okay by making the mode parameter in both functions an int. Link: https://github.com/ClangBuiltLinux/linux/issues/46 Signed-off-by: Nathan Chancellor Acked-by: Gilad Ben-Yossef Reviewed-by: Nick Desaulniers Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/staging/ccree/cc_hw_queue_defs.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h b/drivers/staging/ccree/cc_hw_queue_defs.h index 2ae0f655e7a0e..b86f47712e303 100644 --- a/drivers/staging/ccree/cc_hw_queue_defs.h +++ b/drivers/staging/ccree/cc_hw_queue_defs.h @@ -467,8 +467,7 @@ static inline void set_flow_mode(struct cc_hw_desc *pdesc, * @pdesc: pointer HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC] */ -static inline void set_cipher_mode(struct cc_hw_desc *pdesc, - enum drv_cipher_mode mode) +static inline void set_cipher_mode(struct cc_hw_desc *pdesc, int mode) { pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_MODE, mode); } @@ -479,8 +478,7 @@ static inline void set_cipher_mode(struct cc_hw_desc *pdesc, * @pdesc: pointer HW descriptor struct * @mode: Any one of the modes defined in [CC7x-DESC] */ -static inline void set_cipher_config0(struct cc_hw_desc *pdesc, - enum drv_crypto_direction mode) +static inline void set_cipher_config0(struct cc_hw_desc *pdesc, int mode) { pdesc->word[4] |= FIELD_PREP(WORD4_CIPHER_CONF0, mode); } -- 2.20.1