From patchwork Sat Oct 7 13:50:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 149584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp937527vqo; Sat, 7 Oct 2023 06:50:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfZ3yU3ssw99cVmEbUxvxUC+0rvBaeKvHG8OxSzSeYHC6OxkrcXqHqEv//h11aTJ0enYEF X-Received: by 2002:a92:cd82:0:b0:351:80c:bc29 with SMTP id r2-20020a92cd82000000b00351080cbc29mr13862522ilb.17.1696686643971; Sat, 07 Oct 2023 06:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696686643; cv=none; d=google.com; s=arc-20160816; b=Yl7OTnm1PPbAHJ9wwCjeRRqX+yq3xYo3ospveqn6SkseB5TfkHe8rnw3Gl38khzzGJ 24USYevEDFUOSsJjAdpKecLvAlSjXresIQGslCsrk+Bswr1YiYzx+wL48uzTmcLcKA3Y IbRbWN2JyU6LoI9HWKxmm/CvMYwu5JxDo8tnWGLEOou0Bk+aIw4esahEU/4KmM4TyfKO c9VBbD1Rl1PZHmgxOENVpFSUvnGeHeOmhrrOV5HMCBHjYjmxKVlI4fS2jel38fkf5LME uvH2SXLI2/CkAwwktKKIjmOusF7zyY5KZC8lt9eRsb0FsIWJEVIYoPnshypVNRM3z4Lr TGgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+NsrC/kMBjP5jYS5nCk9DfFO8Yn5kcVnJ7NUbypxWEE=; fh=tOp9lGNhnedf6krqTCD4HcouwliXcIIGGFc88vBGnK0=; b=xrXM2sTUpEdopyxv0lHcTXTm0b4yr3nAHHw9w2PyPyfwaYGYZ7jjZrrXdZs5aTaZtR g/lJQuL9MKQZq7t5DwtsLrfa11ZC8+WPAet+7GUm2FCzZAc+NTuU5zzvPKV//dfIV/Se 0CdxGHMRF/BIP+ezP+dFfaA+jIi4/YiYhoro+XRA+gIEO045lwWWsml29NBrKS3uGPbl mbM/7UhwFAZPoaKuQGEhkdsNfWqgV0G4a6P2ealsqZgRQm/8Y189ENzAUWvxuj2bOfNW oyVOhisfwvR5iVZf5zDjB0bZVycgMudkc4qQcovQvMr/4ObhNWB2mEELcD3865jkrdFW p79A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="S/BuIu22"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id d13-20020a65588d000000b00578af6c5c0csi5540317pgu.235.2023.10.07.06.50.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 06:50:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="S/BuIu22"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 02D0C804320D; Sat, 7 Oct 2023 06:50:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343880AbjJGNuT (ORCPT + 18 others); Sat, 7 Oct 2023 09:50:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343893AbjJGNuR (ORCPT ); Sat, 7 Oct 2023 09:50:17 -0400 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D34D9CA for ; Sat, 7 Oct 2023 06:50:14 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id p7h0qpPqZqToTp7h0qy9q1; Sat, 07 Oct 2023 15:50:12 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1696686612; bh=+NsrC/kMBjP5jYS5nCk9DfFO8Yn5kcVnJ7NUbypxWEE=; h=From:To:Cc:Subject:Date; b=S/BuIu22dvKaQZVcytkPFaooazzGdz6iVKPujBs6N8X9Uu+z4UbmAnryyDm8S4qTi /tslWKj4umgblAYL000xKgNdUbZF3ReR7cg8t1LtjGq7K9C8rHLXiSBaIqr0tX4ajY 1IZdGZSeVlT5bDdZET+U0jRVhDD8YXIkg+PoPd+IxRBpE4WXztn4p88MCqBEZUxagO O3Z4llfIe3LOG/3i+k/j9RSOS4IfazIdbV3srp82iDeUHRZHw9REoeuJsSZ1Cp/Tc8 w4islVbqKYeLJfgGsoAdVKT5VctLwFS42DqXs9YLwUkMpc6p6zPwlqH/iN/JxHyZ+9 krAqU6VFsdHEA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 07 Oct 2023 15:50:12 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Dmitry Osipenko , Mauro Carvalho Chehab , Thierry Reding , Jonathan Hunter Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-media@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH] media: vde: Use struct_size() Date: Sat, 7 Oct 2023 15:50:02 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 07 Oct 2023 06:50:42 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779104894187369523 X-GMAIL-MSGID: 1779104894187369523 Use struct_size() which is much more common than this offsetof(). Signed-off-by: Christophe JAILLET --- drivers/media/platform/nvidia/tegra-vde/v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/nvidia/tegra-vde/v4l2.c b/drivers/media/platform/nvidia/tegra-vde/v4l2.c index bd8c207d5b54..0f48ce6f243e 100644 --- a/drivers/media/platform/nvidia/tegra-vde/v4l2.c +++ b/drivers/media/platform/nvidia/tegra-vde/v4l2.c @@ -813,7 +813,7 @@ static int tegra_open(struct file *file) struct tegra_ctx *ctx; int err; - ctx = kzalloc(offsetof(struct tegra_ctx, ctrls[ARRAY_SIZE(ctrl_cfgs)]), + ctx = kzalloc(struct_size(ctx, ctrls, ARRAY_SIZE(ctrl_cfgs)), GFP_KERNEL); if (!ctx) return -ENOMEM;