From patchwork Tue Feb 7 19:43:30 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: 9560989 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 C2CE060236 for ; Tue, 7 Feb 2017 19:50:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B55602847C for ; Tue, 7 Feb 2017 19:50:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA32428487; Tue, 7 Feb 2017 19:50:40 +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=ham 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 31A332847C for ; Tue, 7 Feb 2017 19:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755096AbdBGTqH (ORCPT ); Tue, 7 Feb 2017 14:46:07 -0500 Received: from mout.web.de ([212.227.17.12]:63218 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753169AbdBGToX (ORCPT ); Tue, 7 Feb 2017 14:44:23 -0500 Received: from [192.168.1.2] ([78.49.4.3]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LtFYd-1cQ5fM49vP-012mmt; Tue, 07 Feb 2017 20:43:32 +0100 Subject: [PATCH 04/18] HID: Improve another size determination in open_collection() To: linux-input@vger.kernel.org, Benjamin Tissoires , =?UTF-8?Q?Bruno_Pr=c3=a9mont?= , Jiri Kosina References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <19c977dd-521b-c284-adc5-ee4050f3297b@users.sourceforge.net> Date: Tue, 7 Feb 2017 20:43:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:u6Q3mOtfLDkCzLvi75UnotaKUf/Nber7LPUiXF3gPc8TjCOvITt 8XECU7He2POFVgEs0fORzCpkYvQBNSxWP3Ln0++NOVbBzO7eUyGYynlNlmxxQ2XCCmIGPKg UNdyj25A+MH7mTfPJKSly7l47q57AMIExRkTXC5hw5i1aKxsMukFO/YD+NPydtUjlsCwnrJ AV/Gzm8QoZcv5g6eM3d3Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:CKPpZ8pOe4o=:DFZhM/HkX10RDNc3biQpjN d1lMIRLauqqT3QFTD4Z6OBgZRCGk4m9/NcsLStFcPa0PYTCFX6ff8P2XeQAL990GuhIjsWSlU Nk7ey3eggvrS8V+7uoksafS4r4ERAmnERBj5Kmm3dDXgJDKQfwiSImySeYFwLWY9ftmsRqoUX xNoViZue4cmrFWNegzDMgNVXO1gBARt5QONDRCOiQVf7+ajnBSSqDnBqYIzSzbcQRbAjhPtf4 /lfbEnOrdTatbce1DPuANt7jeygttxy69A78oOzEvnjaVnLIB93ft9+NMTMm8rIiIfkG/BUak 2m/B+j/qEan3ztrfiQA3TNHtQcBhc3cpy60hMJNV3lpnZykrfN1pagwMGNfFZtVzGhITm9Ai5 wCsbOfPWR567mF5Sj/deEVAKP6Rtf5TamA2VXgfoa9lvKyTOPvgskl7W7CXcaukL+VitVsU6O tJ1ynZIKFNGrscuwVaTQcDn3KmuqeVtEilodYgHzqSB/fzrK1KhhG9Mfajk84sY2xaxLJ31BT lARj+JzHqUGeQsA7gPkZWH4byp6Ge6Poa+IOCtp/UCdTPHTEu4kivfiJ0/gstX72zvAW9/gBq DerO6cEU90OXrA8NNkf/ZJobm1s258YoNRwt4inw8esL6at3z/nixcmipI4T3R1otHzlHiKfF on21G32Hx6sTEvPUkaMVY5wx/Giq7aiCK1XZcV3rFCU9cQzIKj9p/0Nk+ZRBhEJ0xQXlBfLVk /+yxBfis9XakWGw045oZ5r+Edf6KbWIQyfxHCmo2JG+DoJs92IsGtUSmSneYSJ5/ZlTd0JIIS LAvDgbM Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 6 Feb 2017 19:19:22 +0100 Replace the specification of a data structure 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. Signed-off-by: Markus Elfring --- drivers/hid/hid-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 51f3547ca44f..404eccd0d670 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -138,11 +138,9 @@ static int open_collection(struct hid_parser *parser, unsigned type) return -ENOMEM; memcpy(collection, parser->device->collection, - sizeof(struct hid_collection) * - parser->device->collection_size); + sizeof(*collection) * parser->device->collection_size); memset(collection + parser->device->collection_size, 0, - sizeof(struct hid_collection) * - parser->device->collection_size); + sizeof(*collection) * parser->device->collection_size); kfree(parser->device->collection); parser->device->collection = collection; parser->device->collection_size *= 2;