Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp584037ybt; Fri, 10 Jul 2020 07:26:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytoKgbrGezprCqBsORErseB1dM9lU+RacidPwQVJ0BsGY/J/0NMvvThs7Vj5Q9WHfp8G6h X-Received: by 2002:aa7:d3c8:: with SMTP id o8mr70842691edr.294.1594391198941; Fri, 10 Jul 2020 07:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594391198; cv=none; d=google.com; s=arc-20160816; b=j+y2nn9MQPNxY2h5enN+nHErPSPh4H4oREdsO3K+hoXGxdxpLmnXdRdjj8a1Xx+2Co +DW2Cw/5ny4m4yvEVgbEcB3LvgSRB8PO6AarDsdIEIiIe2hmFCtP3yDQdJcJZvCNDZDT BIJ+Qj9mJgCP/X5gNXE8P4l7Cv1z5MJdrTTQ8h/I2oj77d1irck1S7X28Nx1oqbvyOvs i2oEczy8jpyCNnHiNAG2mdBfoTZSgqQ23oFgex/2h4T7y8DEPrQ1hXmKgK1i/1SbFiNi kCATPEAN8lJHIZLnoXsp5/OR//6OE81Px/nfWFQ8k/ISqSbMcYZ93OC/RNHCyuSOt284 nN2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:cc:to:subject:from:dkim-signature :dkim-filter; bh=k3JSFO5eGGDgdqwjQhLkYWYwXYgt1cqYio32K0vqcxE=; b=Fp7r//xirppKFC7Pq2iZYYKGJ9FWWxHhn3D1u2z63OMUDCTw2qDiK2UOku5ucsS7ky 9brpsRliSvv+m5KHARuh6nVGbjLQmrCMATyZ6+l0vpCFhwCpSEQrkO4lz6uero38cqJ1 ufythjp/PPbLy5xZ21s6MppfB7U76UCrkMdlwdfnk8e4tHiKUxYkgch1vOjszx2cORZL QVhFFPFZifsKrBIJZpwSlEynNucNQPXM0RDqKIPYchk47ud8Zaj5RchnpatfLlQkhY5K DrRk0cvFSSCOPsK8xLNlcW1QWVyxPpkw/5RqZC7vioSBtk81LXNXWtY6iYtmpovCR9jy ikxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=bbBaBWco; 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=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si4270610eds.603.2020.07.10.07.26.16; Fri, 10 Jul 2020 07:26:38 -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=@samsung.com header.s=mail20170921 header.b=bbBaBWco; 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=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728430AbgGJOXk (ORCPT + 99 others); Fri, 10 Jul 2020 10:23:40 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:36859 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728388AbgGJOXj (ORCPT ); Fri, 10 Jul 2020 10:23:39 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200710142336euoutp027b71ca1e68c61499ed416d2a06df3dac~gai6y2LPl0760207602euoutp026 for ; Fri, 10 Jul 2020 14:23:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200710142336euoutp027b71ca1e68c61499ed416d2a06df3dac~gai6y2LPl0760207602euoutp026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594391016; bh=k3JSFO5eGGDgdqwjQhLkYWYwXYgt1cqYio32K0vqcxE=; h=From:Subject:To:Cc:Date:In-Reply-To:References:From; b=bbBaBWco7EoqwPsd1m2kuX6tt3D7TImh6YnAGKbXmrFUdpbUJmwvtSMLAqJtjuzyg TtBLb2JQDWUO42SVwpzwqXlfmu2yx8iCiH2LMw774uy85d9zjG6xzyu1DsgNE4bXST NUkFVQPi7MwTqLLZZdevOS4BghmRVIwoGbPtz0qY= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200710142336eucas1p2667d56def20b47773580a2a449e890f9~gai6fNZ9K2122921229eucas1p2E; Fri, 10 Jul 2020 14:23:36 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 7F.CE.06318.8E9780F5; Fri, 10 Jul 2020 15:23:36 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200710142336eucas1p1b50636467635991d95f8de79465e163e~gai6H-TJZ2928929289eucas1p1B; Fri, 10 Jul 2020 14:23:36 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200710142336eusmtrp1aaa89345fa2898f0f444067b2107b7c2~gai6HYqSK1070610706eusmtrp1g; Fri, 10 Jul 2020 14:23:36 +0000 (GMT) X-AuditID: cbfec7f5-371ff700000018ae-0e-5f0879e84f5a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 11.D1.06314.8E9780F5; Fri, 10 Jul 2020 15:23:36 +0100 (BST) Received: from [106.120.51.71] (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200710142335eusmtip22885cfcc5d2ece2d12cf6f3bc6baee61~gai5xRJZx1450814508eusmtip2V; Fri, 10 Jul 2020 14:23:35 +0000 (GMT) From: Bartlomiej Zolnierkiewicz Subject: Re: [PATCH][next] fbdev/fb.h: Use struct_size() helper in kzalloc() To: "Gustavo A. R. Silva" Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Message-ID: <0a245efa-fa37-539c-4e2a-81d6bcf17670@samsung.com> Date: Fri, 10 Jul 2020 16:23:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200617175647.GA26370@embeddedor> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOKsWRmVeSWpSXmKPExsWy7djPc7ovKjniDRoWKFpc+fqezWLrHlWL XxensVqc6PvAanF51xw2B1aPdQdVPTat6mTzuN99nMnj8ya5AJYoLpuU1JzMstQifbsEroye rcsZCxo5K8589G1gXMjexcjJISFgIjHh/GpGEFtIYAWjxJVbIhD2F0aJ7ddzuxi5gOzPjBIH O3cxwjQc+beaCSKxnFGi9/FZJoiOt4wSp6+Jg9hsAlYSE9tXgTUIC/hIXDr/gLWLkYNDRMBQ YueqBJBeZoEJjBLPeueB1fAK2Em0tL1kBrFZBFQlXl76BDZTVCBC4tODw6wQNYISJ2c+YQGx OQUMJKZ0bgWrYRYQl7j1ZD6ULS+x/e0cZpAFEgLz2CWerJrEAnG1i8Sy4zOZIWxhiVfHt0C9 LyNxenIPC0TDOkaJvx0voLq3M0osn/yPDaLKWuLOuV9sIC8wC2hKrN+lDxF2lPi54iBYWEKA T+LGW0GII/gkJm2bzgwR5pXoaBOCqFaT2LBsAxvM2q6dK5knMCrNQvLaLCTvzELyziyEvQsY WVYxiqeWFuempxYb56WW6xUn5haX5q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sk6PaOiNMgmQO+/NZ/Z20cPMHuQbftNiNiYIftjG+rVtkutllycJloj7XSzx7 lgdofLngIcrTeGTqvQk3p19yND/74qH1garUKTwONTbPYyfVKbEUZyQaajEXFScCAKirriq+ AgAA X-CMS-MailID: 20200710142336eucas1p1b50636467635991d95f8de79465e163e X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200617175132eucas1p2f1ea5f3b2f0d5cdb3277577ac8564c3f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200617175132eucas1p2f1ea5f3b2f0d5cdb3277577ac8564c3f References: <20200617175647.GA26370@embeddedor> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/17/20 7:56 PM, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes. > > This code was detected with the help of Coccinelle and, audited and > fixed manually. > > Signed-off-by: Gustavo A. R. Silva Applied to drm-misc-next tree, thanks. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics > --- > include/linux/fb.h | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/include/linux/fb.h b/include/linux/fb.h > index 3b4b2f0c6994..2b530e6d86e4 100644 > --- a/include/linux/fb.h > +++ b/include/linux/fb.h > @@ -506,8 +506,9 @@ struct fb_info { > }; > > static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { > - struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct) > - + max_num * sizeof(struct aperture), GFP_KERNEL); > + struct apertures_struct *a; > + > + a = kzalloc(struct_size(a, ranges, max_num), GFP_KERNEL); > if (!a) > return NULL; > a->count = max_num; >