From patchwork Thu Oct 8 08:10:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11822443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E82C17CF for ; Thu, 8 Oct 2020 08:10:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAE7F2083B for ; Thu, 8 Oct 2020 08:10:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DAbFTuB9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAE7F2083B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DFBA6EA3E; Thu, 8 Oct 2020 08:10:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5CA356EA3E for ; Thu, 8 Oct 2020 08:10:16 +0000 (UTC) Received: by mail-ej1-x643.google.com with SMTP id c22so6820427ejx.0 for ; Thu, 08 Oct 2020 01:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=kyF7Q7Jij+WMhi1ATXfqPByemGcEx/t5FoN2ScmUxN0=; b=DAbFTuB9eyP+2iw49Nel8SNbKmXjKL1GLiuMrZMZl+exrPkCGfJ0iu3CJenCydoEpB kdyapFvOM74GQZoxtVLWNX2gdeZLqcvB24+eKabERdHObimdnmJ0pFEsB4/SBHD/ZpXV E6pGq+3h2v9DYK53binj03SEL3gR81zyqMwOS4qnM/GdOrHh2OwnNELx9VhsLNfJ6Cgl vYJb3t3WQE0Etx/3uPbXib1ScvvzDTNHL1bhMtrdgfxP2x4oKVrOAZAkDT3kg9wEp9dW VUkCOlE75dILQS6KqeKVuyIFFJ3PfSVO+jA79w6lrNPkGaBwD+mqKGvLtGOfPbJoV95K dvmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=kyF7Q7Jij+WMhi1ATXfqPByemGcEx/t5FoN2ScmUxN0=; b=rtt+QKLy51MlGltGJ66dSfNpEUub6mhhY99gwNQ/PmKwmbFTRWvRwknM11klKOlpA2 9m2aQvI2QkQkKNyMgleU6a3kKbxQcLkIyGwI0ZPLd3w9iK4evHgEaUi83dSqi2V3iamM 4TNig4Cyp8eldYosieZxD/USHprFkXY79UQcBf/4wilH+QHVoZGFL/rnriVCsY15opxr v0J95hKu3r1fdf0i02y9Xg80Y6yS985WBTEbHuwTCGcp/aMWRBIvMxqfIW+w8RuW1yp8 lfpzhwTsZhVfnYCYAZTqYwP8UB9dD9I8dbFC7EOP6lcHLCbjI4JeOGNsiM/VFsPsGOix Q3Ig== X-Gm-Message-State: AOAM5338G15cXheaMqqAtjowTQZVyfeoNrjkLOFOZcHo18V9QTUzQn03 7HzVSTKC6s2ycsNOyuZs/Lc= X-Google-Smtp-Source: ABdhPJyT06Bp3zdwPZAzyVicXb67EvjI9bgjxiL+jlBFhFhMBdMH5XJlZa6hcv56s73ca8jIAv607w== X-Received: by 2002:a17:906:1f53:: with SMTP id d19mr7409558ejk.255.1602144614921; Thu, 08 Oct 2020 01:10:14 -0700 (PDT) Received: from abel.fritz.box ([2a02:908:1252:fb60:a581:54df:e21e:7499]) by smtp.gmail.com with ESMTPSA id yd18sm3475541ejb.10.2020.10.08.01.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 01:10:14 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: gustavoars@kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH] dma-buf: use struct_size macro Date: Thu, 8 Oct 2020 10:10:13 +0200 Message-Id: <20201008081013.27384-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Instead of manually calculating the structure size. Signed-off-by: Christian König Reviewed-by: Daniel Vetter Reviewed-by: Gustavo A. R. Silva --- drivers/dma-buf/dma-resv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c index 1c8f2581cb09..bb5a42b10c29 100644 --- a/drivers/dma-buf/dma-resv.c +++ b/drivers/dma-buf/dma-resv.c @@ -63,7 +63,7 @@ static struct dma_resv_list *dma_resv_list_alloc(unsigned int shared_max) { struct dma_resv_list *list; - list = kmalloc(offsetof(typeof(*list), shared[shared_max]), GFP_KERNEL); + list = kmalloc(struct_size(list, shared, shared_max), GFP_KERNEL); if (!list) return NULL;