From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763834AbdJQS50 (ORCPT ); Tue, 17 Oct 2017 14:57:26 -0400 Received: from mout.web.de ([212.227.15.4]:62328 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753656AbdJQS5Y (ORCPT ); Tue, 17 Oct 2017 14:57:24 -0400 Subject: [PATCH 2/2] powerpc-ps3: Improve a size determination in two functions From: SF Markus Elfring To: linuxppc-dev@lists.ozlabs.org, Benjamin Herrenschmidt , Geoff Levand , Michael Ellerman , Paul Mackerras Cc: LKML , kernel-janitors@vger.kernel.org References: <36a8ba41-7f1e-31f8-5d32-19e04393b181@users.sourceforge.net> Message-ID: Date: Tue, 17 Oct 2017 20:56:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <36a8ba41-7f1e-31f8-5d32-19e04393b181@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:xIVjjMpOc68v2qtK49SAOr0Umf8mjLn39kxhnaSe7bpujrPfu7R m0+ucB637CrXQCLBEzmR/jqK19aaSegHWLeriUh51M9ou2m3U5SAbvXcW3RBXRB85U9XEny 6WbfqJz9T19B0coxZL4/ZyKCEbi3F39WSheo2524HB389pj+EOjnKUQq2AqbNR2z/7hwlfF qQttNQg9zO2+dB8piS0nw== X-UI-Out-Filterresults: notjunk:1;V01:K0:ljFANmFsSoY=:X2ZCN/f867FzBpYX6kwm6C pCv5jmMvyJ1f/n6P+uhQwMNtp5jUdRyNn4OOF9GH+vbPRIzlFJmeOtyh2n8iQBFbUr1EXU+ya UI5kBe6tuVujg+4/Lo357fPKmiQxFNwrtPwUuGxb4PkbWF2TfMQ66+a0Dwk7zhRFJZHuqu/1M E8SFgt5fVyI0r1O//t+RJP4MgAu/O+ang7XJTUAh1cTDHnB2vlFHUNDC7q81S2SSPkNLlvMzC C/9/9ij0dx6HnwxKPD3QSoKauthVkbqnyNCZMff9JYzfriFE1OxqT6euRvi3So/ISRdFYRsje /TupyYSC+B9hcRkp8JCKW+/k9kshE5eNKew8Y8nCE4aahBtPi0QzbevTlTv0Tt0P7csDTPbN8 VWhYuiUYqQp8TZJeUUe7e5tYd/9DeBjdr0GdIZHdA1WW93eD06QIvbCxB6HbYSoNjQnwzBhqt 4yZfQzezWeXBt0Tj23bHvfrpGzi83E7r3pJIXJ/IuDPRb5Gjx2s0VkBQOoCmZIE33BqMxZYwu 7ur5pQlsl01pEh/E7XeCPLmMBsxzoacbgWunl7PlHRaVOo+U72dMaw6crp6XhWWDs6lYA4DMH YpjrDY/BRb2Hr5v7VOo1MsoPbNVW6W/7rYG1+WYI8Omjnt2+ycrlJuSlHWypdmajLCJyHJKDf kBzTOdWznfM8xjJmXVoEXO8SexgOjx69l+2tu9x8NKseVPfyrBm0fov2L8DNVc6O7GrKVOSBQ HTp4kf+nQsJ5AXapkoE0nxtGPcnJFiispQ9y8LhbpQv5XmEWjfAiBO7kC1aA/I3oOmzwwHVmk CHxEq9K801lUZqulRXmXCODipzuOq4r8YPwlGDTvitRDSRFiBY= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Tue, 17 Oct 2017 20:15:17 +0200 Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- arch/powerpc/platforms/ps3/mm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index b0f34663b1ae..257de451e324 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c @@ -524,8 +524,7 @@ static int dma_sb_map_pages(struct ps3_dma_region *r, unsigned long phys_addr, int result; struct dma_chunk *c; - c = kzalloc(sizeof(struct dma_chunk), GFP_ATOMIC); - + c = kzalloc(sizeof(*c), GFP_ATOMIC); if (!c) { result = -ENOMEM; goto fail_alloc; @@ -570,8 +569,7 @@ static int dma_ioc0_map_pages(struct ps3_dma_region *r, unsigned long phys_addr, DBG(KERN_ERR "%s: phy=%#lx, lpar%#lx, len=%#lx\n", __func__, phys_addr, ps3_mm_phys_to_lpar(phys_addr), len); - c = kzalloc(sizeof(struct dma_chunk), GFP_ATOMIC); - + c = kzalloc(sizeof(*c), GFP_ATOMIC); if (!c) { result = -ENOMEM; goto fail_alloc; -- 2.14.2