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: 9715925 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 4352260364 for ; Mon, 8 May 2017 09:12:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 268D122B39 for ; Mon, 8 May 2017 09:12:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A29326E78; Mon, 8 May 2017 09:12:53 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDF1D22B39 for ; Mon, 8 May 2017 09:12:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753374AbdEHJMk (ORCPT ); Mon, 8 May 2017 05:12:40 -0400 Received: from mout.web.de ([217.72.192.78]:60424 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751373AbdEHJMj (ORCPT ); Mon, 8 May 2017 05:12:39 -0400 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 Cc: LKML , kernel-janitors@vger.kernel.org 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 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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);