From patchwork Fri May 19 11:25:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Min-Hua Chen X-Patchwork-Id: 13248244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2118C77B7A for ; Fri, 19 May 2023 11:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Y0Ldiw0SOnL9tPCUGNWHLyTtIqd14RQAaaIZ01FG1Bk=; b=BvAXnpR8G7OM2E 8nyV2+g73qLDxaMBWCXZj+cxM276NjL40HVG0I6NQ0/EnK2MKCzX3XEEXIDbeQm1KVTwbDib33QW3 xTUEbW6D4hjOI2ugCuzhngwbn9xF78O0cZqfaFi+DWdMQrYCZB2TTzJFsofAVEbnaOQvlGhZA2MWY 6S2TPuzU4S3uSCS2k41MWjPaCf9GVOxAXj5KmWC09Qf/ejcZxy0L5Hml8suct+P+1ZLruAII5QEX7 bVt7JJ3JcWjGfFLhhyOL2PmzYucRbXJ65uFwfcbc3zBayPGJM34cRIDW4QMRUiyq7HlGCOy7rQJ8q d7VlVe7jgNH/NA82zaOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzyEZ-00G6Ib-1m; Fri, 19 May 2023 11:25:19 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzyEX-00G6H1-09 for linux-arm-kernel@lists.infradead.org; Fri, 19 May 2023 11:25:18 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6436dfa15b3so2277137b3a.1 for ; Fri, 19 May 2023 04:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684495514; x=1687087514; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6BlLLSb4t/MYbESNdbnlmX8aWP0pTO6ZrGYiXtEq3JU=; b=AdTJK5Yy8ERyK+67dFz4QkLtifLll3Mh81VfJnwH6n2WmKtkscqtfrb18kd61SrlMk rEYjInP3g6CL/QzhLYXKtHy2rqbRnLySMQrx4d9+Fa4+g4V0YPPWaFM9nUOoh/LumoFy OZUIYQAtJn04uQJu4aXzlS8VovVRqEy9YvQFR2hJL2P2Wkum21BlJljtPLghAKEiQrGn B8CT2s+owWDQYOnyySWTIjmu0ZDxrz/bD5FNvUxlZvffgK9XHjUI/Mt84CyrqHvcomQj z7kWdqKBUw5VLgIxiSL4YkDb+E6Qc7SWy8cMy4oV3arBSAFbRqVN9I21cxzZ56OkPKbp qdUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684495514; x=1687087514; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6BlLLSb4t/MYbESNdbnlmX8aWP0pTO6ZrGYiXtEq3JU=; b=V2asG9OvPu6QwFJWUnqWXQZuqjIwrLVY2YeSPzg4Go2prN05xLFBEvpIYdtMFHX5+V DBqhPk+UQDhcs/bZ8YpmNXRn6DzBcW8kIG+jA/qhrro7CDOLVVwYqGSwtNOvZ88RVlwG CxEPfdO03AMxedtkXezRKriWNJWgMqEDKSM3kYKoWXu5b0SeDsv8M4xbvPr8CsWMlFYE hINETPXIyqEZ4INXjFLAHuk+CJAEjl8jMjLAdshGN36Y3X0uplIkpIP0vYvIP7h74YIq 5StKveoeGG46HMIlAlUqDLphe7+oqTsbOvVrQvKQTfYaLhdrBGO4J5s6BO08bv+22LOx 8bQQ== X-Gm-Message-State: AC+VfDz2qZpEWYXQr5CCy71IJxoj4zETqN09Zn0GnsYwZLPtS7/BE+cO gMLJduJAM7cnvWUDy05zBoo= X-Google-Smtp-Source: ACHHUZ64CiYvdspneYPeXoJ9FG78ZZve8AsKQbiHpjWwuP8+rb6oiNv3DRb2T5J8X8D5z9uBuDDoiQ== X-Received: by 2002:a17:903:2343:b0:1a9:9a18:3458 with SMTP id c3-20020a170903234300b001a99a183458mr2800765plh.31.1684495514183; Fri, 19 May 2023 04:25:14 -0700 (PDT) Received: from ubuntu777.domain.name (36-228-97-28.dynamic-ip.hinet.net. [36.228.97.28]) by smtp.gmail.com with ESMTPSA id a7-20020a170902ecc700b001ac95be5081sm3170111plh.307.2023.05.19.04.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 04:25:13 -0700 (PDT) From: Min-Hua Chen To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Min-Hua Chen , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: stmmac: compare p->des0 and p->des1 with __le32 type values Date: Fri, 19 May 2023 19:25:08 +0800 Message-Id: <20230519112509.40973-1-minhuadotchen@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230519_042517_091549_11CABCA6 X-CRM114-Status: GOOD ( 12.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use cpu_to_le32 to convert the constants to __le32 type before comparing them with p->des0 and p->des1 (they are __le32 type) and to fix following sparse warnings: drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c:110:23: sparse: warning: restricted __le32 degrades to integer drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c:110:50: sparse: warning: restricted __le32 degrades to integer Signed-off-by: Min-Hua Chen Reviewed-by: Simon Horman --- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c index 13c347ee8be9..eefbeea04964 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c @@ -107,7 +107,8 @@ static int dwxgmac2_rx_check_timestamp(void *desc) ts_valid = !(rdes3 & XGMAC_RDES3_TSD) && (rdes3 & XGMAC_RDES3_TSA); if (likely(desc_valid && ts_valid)) { - if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff)) + if ((p->des0 == cpu_to_le32(0xffffffff)) && + (p->des1 == cpu_to_le32(0xffffffff))) return -EINVAL; return 0; }