Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp645900lqm; Wed, 1 May 2024 11:09:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV4shLqCeHBbuy4KWLGL6ys5OJ9ACwODUrab1m1t8pZNSDow8/MQfSEhyghIWG2GAZnUV9nE7r9bTyp/kqqa3ZW2vzuyrr094yX94uoBg== X-Google-Smtp-Source: AGHT+IGRZHeB84e3Cl5R8FF+xPkmYHRanTJfibLZen6513rFH3yvarbnqcWrA9jOL+2481/NOuwn X-Received: by 2002:a05:6512:159e:b0:51b:18f7:6a9e with SMTP id bp30-20020a056512159e00b0051b18f76a9emr2519017lfb.45.1714586983066; Wed, 01 May 2024 11:09:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714586983; cv=pass; d=google.com; s=arc-20160816; b=dH7Ob8Yde0wbGffdDecjEQZPSMQaP/CPGT0cPidQ5+t7b7F4Ok1k+E7lC0Fp9uwodT i3zwjHp9x4/wJneI31+WczRGbDaR5gEZQUSWLIhEOODGchMpNkkxlpDQEXR++AyMtiQc RDeVlPMW+cmPkbFCkXwlGc5IUra3jqq7SL0+582b+fbj1haMGsJ/vhR92xbw4WPDgvgv njqFltQy+nQvM0DvSltCFP47AOiy5qEoPxdobbb8tlr3qZBVYi0k1G6/Zz3O6qm4749W bg47/bWO8E36oIrm52h6jGSOZYj7AOdW5u/+A00J6Xmq25PCJo/6tUo62fd2CN5/IEaj JiMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=+7Ns2pyzSkQJV5WPBZdxa8kJ9QnVM4NSGfgJFq0Gymk=; fh=MVqpKOw+NtjYG0l66aid4cIhcUSIRPBPnvP9NzWMTso=; b=EKJQr0mgi6csgQfgGgTRuTXUSkr1yPXA5a20Rmo4ugXRvRNlu+yRJmlIS165v8Buvk PtqRQ7sdTMNLSuHZiGTWeoH0oMQZXXF0OXBGqKx0p8+o1e/OsnmVubiBgC3l/0GWztqD o2DD42uIRXGI99vBHaMmd2fl3Ivu7qVbtZpdhnVSKHWDsG6tfoQ/BgrOkwBm6gZMiW6k phD1U9vTtplJYYR6ptHhxibvaBMymaic0NS9rDwSkoNTKaAAPfjvAooEFq6XHJmEs9CE MFc9glsMwIxghxjT73bQsKka9AIMeDA5gM8P8TgkfviIo1K9BfMgueFxEAHnoKO8/tb6 3nXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ucjyC0Vr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-4235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4235-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cw24-20020a056402229800b00572a0f5408csi1670271edb.432.2024.05.01.11.09.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 11:09:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ucjyC0Vr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-4235-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4235-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C24BB1F212D3 for ; Wed, 1 May 2024 18:09:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96FAB1474BA; Wed, 1 May 2024 18:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ucjyC0Vr" X-Original-To: linux-bluetooth@vger.kernel.org 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 EABCE32C85; Wed, 1 May 2024 18:09:33 +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=1714586974; cv=none; b=FPGuA5upsb7BYqxeQHo/kX0VCAZd0iXYgCBmGA2RRIAocaYIIIXSQvH2mCqR13MJ4nIXZD0PlKd8cFhCIHzUxzDtcl4X8NMim51Bc21FQXZidoGlOzGdot1ubPquNG/8XSGqGuYD8g84CWYNsgrabkCReRY5EZ/mGzC9EFJeIkQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714586974; c=relaxed/simple; bh=MULF2BuYchdZjEi0jXH/BGhGQooN6HzY1iqm4UGt4E8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=W1qS8Q/YrqiZfTwZ4991rmo6WYlI0RFOLvCTpWIMN2VNVaZiLf053j3SJhhEm84f0Lw2lQ+QxX8WIECOHXP+U7wWFeaaD5/s84XrJ0xaBd0JWQVMXdNi3Tr9YW2bEJsy0FgZsbQH7ydfXnTrbjqe8sNYoTF7l6EzUPXDcOQUiTU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ucjyC0Vr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D938BC4AF14; Wed, 1 May 2024 18:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714586973; bh=MULF2BuYchdZjEi0jXH/BGhGQooN6HzY1iqm4UGt4E8=; h=Date:From:To:Cc:Subject:From; b=ucjyC0VrS3uEaIvN2xZjQVRM6b6Zdze7sQgkRbpt0xE1GHnUfeQl8scyMiE+UBCwt 2ynCEZ76tDRlF56K8GtZkYmry3K/wzUa4lWIo2te8Je+m3C811IYMSKnlThUq9ohn7 UhhgyzkD0IHJUIsw9zxL72A8geZpVkKcRPilx4OXIUrnlcn2FNB2AZsD/0J2Es+V79 GcZVKbhbE0Ssd03IDucaXl2rLFd1JqMA0roMXMb/D2HpVL++4PKEEs2U+KCtc+Bve8 RD1ygfm0Lr1psTe6lJ7Q8MMe5JRdeM8rumd9L2j6MBzCsebC4cMuusRqyGNau+1qS3 L6ClQOGTks/qg== Date: Wed, 1 May 2024 12:09:30 -0600 From: "Gustavo A. R. Silva" To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] Bluetooth: hci_conn: Use struct_size() in hci_le_big_create_sync() Message-ID: Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Use struct_size() instead of the open-coded version. Similarly to this other patch[1]. Link: https://lore.kernel.org/linux-hardening/ZiwwPmCvU25YzWek@neat/ [1] Signed-off-by: Gustavo A. R. Silva --- net/bluetooth/hci_conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index d6daf55f0307..c508609be105 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -2135,7 +2135,7 @@ int hci_le_big_create_sync(struct hci_dev *hdev, struct hci_conn *hcon, memcpy(pdu->bis, bis, num_bis); return hci_send_cmd(hdev, HCI_OP_LE_BIG_CREATE_SYNC, - sizeof(*pdu) + num_bis, pdu); + struct_size(pdu, bis, num_bis), pdu); } static void create_big_complete(struct hci_dev *hdev, void *data, int err) -- 2.34.1