From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79728156C78; Mon, 16 Sep 2024 11:59:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726487966; cv=none; b=rjGGcyuad8UceEG9gi46YqIUQWhsXtDx3UvRl0HC4kWlnBeOB04b4hYeQIHY3eEqVqEK2v3NGazsbjcjxwwWE7ax4w0fZ+gGMH96fXhLIFyF7kGywgH0gq9oktCTcJSxgZaBJuMTsSvLCyyaiNfE1/5uG0pXmKnxuTES2XwWp74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726487966; c=relaxed/simple; bh=Iiyx/2i11zO02PZAC4kUHIbd4MHLtG4FWgcZVmK61X8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TwFH5p3uNxCtAnw5ouWVhCr0GQrJp1yPgVOLtA397cXqSe4F+Xmd+3uduoiKrXq7SwcauWQr96aDypb+i8DjcaVtaAe9HF4fzcZ0DJGI1Gc/ytCy/UwgANr7vC64LxROKmON/blq1Pd4AbTGXMWKIp3EsKvBCg1aglYT/afyhBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NNUfQ64b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NNUfQ64b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9A4CC4CEC4; Mon, 16 Sep 2024 11:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1726487965; bh=Iiyx/2i11zO02PZAC4kUHIbd4MHLtG4FWgcZVmK61X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NNUfQ64bILf7cpoaIp3G65pBQBkjisZfi7hDVsR6nqjC54q3sUyhigBJorGVfxSwl 4Wk7ldaUKwqpH0kcVoJri4OTNdHsMUh+6a5dWNkADpjfhUSZ7/Tl4J6Q+jFSRTTcJo ad6/oRJZzaouNMvDLFzS9fjUasuoFi6L1fpbx2Cg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Moon Yeounsu , Christophe JAILLET , "David S. Miller" , Sasha Levin Subject: [PATCH 6.1 04/63] net: ethernet: use ip_hdrlen() instead of bit shift Date: Mon, 16 Sep 2024 13:43:43 +0200 Message-ID: <20240916114221.182462953@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240916114221.021192667@linuxfoundation.org> References: <20240916114221.021192667@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Moon Yeounsu [ Upstream commit 9a039eeb71a42c8b13408a1976e300f3898e1be0 ] `ip_hdr(skb)->ihl << 2` is the same as `ip_hdrlen(skb)` Therefore, we should use a well-defined function not a bit shift to find the header length. It also compresses two lines to a single line. Signed-off-by: Moon Yeounsu Reviewed-by: Christophe JAILLET Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/jme.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 1732ec3c3dbd..a718207988f2 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c @@ -946,15 +946,13 @@ jme_udpsum(struct sk_buff *skb) if (skb->protocol != htons(ETH_P_IP)) return csum; skb_set_network_header(skb, ETH_HLEN); - if ((ip_hdr(skb)->protocol != IPPROTO_UDP) || - (skb->len < (ETH_HLEN + - (ip_hdr(skb)->ihl << 2) + - sizeof(struct udphdr)))) { + + if (ip_hdr(skb)->protocol != IPPROTO_UDP || + skb->len < (ETH_HLEN + ip_hdrlen(skb) + sizeof(struct udphdr))) { skb_reset_network_header(skb); return csum; } - skb_set_transport_header(skb, - ETH_HLEN + (ip_hdr(skb)->ihl << 2)); + skb_set_transport_header(skb, ETH_HLEN + ip_hdrlen(skb)); csum = udp_hdr(skb)->check; skb_reset_transport_header(skb); skb_reset_network_header(skb); -- 2.43.0