From patchwork Mon May 8 09:12:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9715921 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 17BE060364 for ; Mon, 8 May 2017 09:12:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF73622638 for ; Mon, 8 May 2017 09:12:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E33192684F; Mon, 8 May 2017 09:12:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9FE6D22638 for ; Mon, 8 May 2017 09:12:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0CEAF6E1FC; Mon, 8 May 2017 09:12:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [217.72.192.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id D1C1F6E1FC for ; Mon, 8 May 2017 09:12:35 +0000 (UTC) Received: from [192.168.1.3] ([77.182.37.117]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MPYJJ-1d3VzN2xkH-004hvu; Mon, 08 May 2017 11:12:32 +0200 Subject: [PATCH 2/4] dma-buf: Improve a size determination in dma_buf_attach() From: SF Markus Elfring To: dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, Gustavo Padovan , Sumit Semwal References: <3d972fa2-787a-d1f2-ff86-5c05494e00d3@users.sourceforge.net> Message-ID: Date: Mon, 8 May 2017 11:12:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <3d972fa2-787a-d1f2-ff86-5c05494e00d3@users.sourceforge.net> Content-Language: en-US X-Provags-ID: V03:K0:jhOarXVCXlhT1nrhezxV55seAKTqSZg7o3YtGfJrhbEIR9/dI28 ZN4YZgIQ6SrgZmWbl7xEI3JrsyeMBNZGDnEKGuiajylwxEmTro0uRVd29Xy5644n01gysKV r7YLyfZ6uvX4HJJWms3IPJ7OhyOBOFPxDvm4ONMI4vuA7nPmYItl+9vQO2V62MzHp8TQXnF T+M7ooAjSmWe4VPXl1GDA== X-UI-Out-Filterresults: notjunk:1; V01:K0:FG8yoCf406w=:sn+2gvf/kiPa7MAJFUIL6g DwOrcyqi4togxWpazxeABkYXN7+GGuKrY2GmpKaJMuEYlvG4Oq/ElWt/NJMw9Xx02DQqWHXyR +0a9+6Vl3hkEztk1kU5gFHh+CHXPhLcGBI8RCCeWIaqqO09rEKednhhIWVupU11BdLXg82dUp LnGuVA86Toyph17aQlxWADq80OHA2idnRW68OPO8xeJFN0ks8ckc0Mx9he8z5LmAxYEcAKn02 fcN3Z1k9nXRZR0J9YTHSy2ltji09vFMb0SKYNbS5TogbF1ciryg7YyS2ny59TNIt6QGSLvUKn KgKviadnxDiSubbeLSEK9Y9t9ku1pZV0c5sh3Ki7yJf5XHgvexYAT8MxSylkRBr1in96v/cNB /0W+zQG+MjdpJpeuqkaM0XwzSd7/2v7uVjj351iROywP70lGIg87tE4ToAaZ1icIgFgJvgqdp f4kuHaSRBhKsBpsaL5cxDIQ8piHVYIUGBcW8dOjebwJbj38vc+FlAzLxOuHjMYO8GZx6T3CwI MtZA4zSmLXSeGNH2DO3ctErCq4/yW+TTqtiIriE2lqo9/em8cyx0uMnM86j2btfoK4CgxeNut DT1CthxeEQdwZWl9sltJg2IkyOzOidIVTVv6rvNYvRYnB/cT0cIR0xxpC+0QedlxDiBWvCZYO 4nygoNcs0SL53gKlcto/upPzibJeT2tDmNcmA4a96jNKbGqvzBuo6ugzp8gMe+cTN9kyDkKGt D/3XLvbVTycuRQfG4DJMqbQ9y7JatXtk4PdES8H92N2qTA6A3RN6Bx5yptISVNxNn5UXRicE9 7EbwZOM Cc: kernel-janitors@vger.kernel.org, LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 8 May 2017 10:50:09 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring Reviewed-by: Gustavo Padovan --- drivers/dma-buf/dma-buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 53257c166f4d..9887d72cf804 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -558,7 +558,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, if (WARN_ON(!dmabuf || !dev)) return ERR_PTR(-EINVAL); - attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL); + attach = kzalloc(sizeof(*attach), GFP_KERNEL); if (attach == NULL) return ERR_PTR(-ENOMEM);