From patchwork Thu Oct 19 07:06:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 736185 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94F15CDB482 for ; Thu, 19 Oct 2023 07:08:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344812AbjJSHI4 (ORCPT ); Thu, 19 Oct 2023 03:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344910AbjJSHIh (ORCPT ); Thu, 19 Oct 2023 03:08:37 -0400 Received: from forward102b.mail.yandex.net (forward102b.mail.yandex.net [178.154.239.149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE4C11B for ; Thu, 19 Oct 2023 00:08:15 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:d315:0:640:bb64:0]) by forward102b.mail.yandex.net (Yandex) with ESMTP id B55FB60975; Thu, 19 Oct 2023 10:08:12 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id B8gBfIQW1Cg0-L7fRSbfS; Thu, 19 Oct 2023 10:08:12 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1697699292; bh=wlmV/2sYnf79wVrjzIAMKySox4ihNFq0naaLhcKL3WI=; h=Message-ID:Date:Cc:Subject:To:From; b=FgWi4kD6b60JVb/b8Q0lk3zwrH4mx+KFjRyu13kOPwPuZ4XSzU4e2GP1CaRgncWZi cOr6X8JDeU7Fj5lOz0N37uq8ye2CvkWa3tTin1LRnh1XUzL24k1/nGdEcG+MYW1nan wFZdy7PK/wsRHjrt/g950HlOd1ICJjaHl0qQFo9c= Authentication-Results: mail-nwsmtp-smtp-production-main-31.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Stanislaw Gruszka Cc: Helmut Schaa , Kalle Valo , linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH] wifi: rt2x00: simplify rt2x00crypto_rx_insert_iv() Date: Thu, 19 Oct 2023 10:06:09 +0300 Message-ID: <20231019070750.17911-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In 'rt2x00crypto_rx_insert_iv()', added alignment can't exceed 3 bytes and ICV size is either 4 or 8 bytes, so skb space adjustment may be simplified. Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov --- drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c b/drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c index ad95f9eba301..1000fbfb94b8 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00crypto.c @@ -197,10 +197,7 @@ void rt2x00crypto_rx_insert_iv(struct sk_buff *skb, transfer += header_length; } else { skb_push(skb, iv_len + align); - if (align < icv_len) - skb_put(skb, icv_len - align); - else if (align > icv_len) - skb_trim(skb, rxdesc->size + iv_len + icv_len); + skb_put(skb, icv_len - align); /* Move ieee80211 header */ memmove(skb->data + transfer,