Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5359590pxv; Wed, 21 Jul 2021 03:38:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3udF4QR39JggND7OCvl2PsdGQZfW0rFzW4ziZmKQ7JZr1N3pJFpbwBVc7AJav6nFPyT+3 X-Received: by 2002:a02:cce6:: with SMTP id l6mr30517325jaq.114.1626863929672; Wed, 21 Jul 2021 03:38:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626863929; cv=none; d=google.com; s=arc-20160816; b=zE8KAvdDV2qCQWISq0h0Dy/ezNNmRefr9QgXU0xa3G4oPZgIx6gHAnXNOG1mgIb++a zta7OSUI5RWZVjM3A1ndIC3VGf8iqv+6VpN7QkWcaog9IXeFm0nO1F5qsF4Bn9fhgdMS EB9mVKZKWu4SGu7YVPyx07NVsj4eoAcF6AQqMEFai8XVyPeoUnS2r1K5Pqc7LomW83ct gn6lRH3FFCpnsw33gTsPNbYEbVMPvIpEoxDBUqFLLaG6hbcspAP2HKT3lw0vGTfT+J4R gB5vfXRqllrb1+gzenxrTQGRnAkw7UqHbxKRMcQJduqFjCDnI7AJN40V7jPjqdH5KBTv +0qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QTF7O5HzF8haTDzz11IYFCmXhr6sJ8z3PRlb5qVd+sA=; b=Dcc7hayckWgMbqfWA2dg9kHs9J2f3OWLvZTMPObT8mz3cqrOpbs+BIudLyedO5qcG9 fxw63OmFP7HeSpiLsiiXC8ZOF/zbfqVcn+ZuT3mIYFQQDma9H3RunH+emAny4swsvJ63 HnBNt+a58LCx78GFdfuR/jwJLx7jwhLMKkwbQR44GVUeTbYxrlqxSHLDXkxbc0lEirhp JCtj1P0vOV0oWYwYeHfLVKTT2WZb6BG3sdB4k/9SqDEG3/Ffnae/bSthX0j+vSmN27Z2 M2grNgSkr2hHv0wwyuklwz1ZGJ/o8Gq1SDXbVoRwBTZxoOpMXIy1MKjSO3hTRWYJr5D3 7W9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KIdPSwdI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si15208343iok.60.2021.07.21.03.38.38; Wed, 21 Jul 2021 03:38:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KIdPSwdI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239307AbhGUJyO (ORCPT + 99 others); Wed, 21 Jul 2021 05:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237986AbhGUJgU (ORCPT ); Wed, 21 Jul 2021 05:36:20 -0400 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69C9EC061768; Wed, 21 Jul 2021 03:16:57 -0700 (PDT) Received: by mail-io1-xd35.google.com with SMTP id z17so1728527iog.12; Wed, 21 Jul 2021 03:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QTF7O5HzF8haTDzz11IYFCmXhr6sJ8z3PRlb5qVd+sA=; b=KIdPSwdI4SZOtof5J1rQaLGFzfdd9SgzgF8rKwZZkKepZEdqmY22ElWhF9ffDsaTVo d6j+Lc8AZCU5of4jz6fsqMwqv7Q4ZfEQtz1nvNDaufwZ2UUXx1QrCbGbEKbdD2BnDFoW k3N/IJ7WSFT+eSQkhbHIAKe/LguadIMTovMhmgJMPyVaXg0YKKtrGpHYI8g5PUhkVFPC IpbGaW1uHdcdJaK8aaoPEkpX478TPvohjCNhe4CkHC+6ZoDv0AIN1SfHDyU6ePqSzTmd AIY3qtOD3GllH6GNniWvlS6jYdAEpmUQxR7s94SoBeWnsPC9/7ZXMB97UwqrqE5FGfID GrnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QTF7O5HzF8haTDzz11IYFCmXhr6sJ8z3PRlb5qVd+sA=; b=X3+Dkc/eL/dLOGPjx+U09i62U/dh7WVRIzrQN1XYUws4qwsDHxgEEw6W27FH4SKKO+ bFhi0fdW/X2/uRBUwAQdCgORJ4IbxTWoVopSad8OMjqmkfnPwa0XWYU0J9s152vC0ywc p0gpCe+CyslzmGZeqETtygqy0W7sQvKQso21dS73/M+N9edKUg1Mf3qZk6T4lxkwhiId zQXHqwESqQ/58hV8GcEFIpPc89Hu3Bjgx7T80+EcVCxggtG2QN1oe8kuajaPIKZHf4pK WeYTI2LKd90rTXiLH3l3Kkm60hJC3keu77qh5gNbRhVF895HawFsBXBTfTAnODtWH4pN w1Sw== X-Gm-Message-State: AOAM530WddpCBiHnSHxFMEAMDEwxOPzuEhNCh9DvBZ1H5uGeXG0P+viK OjKwdcELrAWIXYbL+69Q1a31YYmRZs+mmapjixE= X-Received: by 2002:a5d:9f11:: with SMTP id q17mr24971479iot.62.1626862616943; Wed, 21 Jul 2021 03:16:56 -0700 (PDT) MIME-Version: 1.0 References: <20210717142513.5411-1-len.baker@gmx.com> In-Reply-To: <20210717142513.5411-1-len.baker@gmx.com> From: Stanislav Yakovlev Date: Wed, 21 Jul 2021 14:20:45 +0400 Message-ID: Subject: Re: [PATCH] ipw2x00: Use struct_size helper instead of open-coded arithmetic To: Len Baker Cc: Kalle Valo , "David S. Miller" , Jakub Kicinski , wireless , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 17 Jul 2021 at 18:25, Len Baker wrote: > > Dynamic size calculations (especially multiplication) should not be > performed in memory allocator function arguments due to the risk of them > overflowing. This could lead to values wrapping around and a smaller > allocation being made than the caller was expecting. Using those > allocations could lead to linear overflows of heap memory and other > misbehaviors. > > To avoid this scenario, use the struct_size helper. > > Signed-off-by: Len Baker > --- > drivers/net/wireless/intel/ipw2x00/libipw_tx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Looks fine, thanks! Stanislav.