Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2712678pxb; Thu, 3 Feb 2022 12:31:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzK4XhZRHuczyi2teb7z+y05EYPCYgvAqJQ70FMclXLA9UhBSpk230o1rRq7EmzOQubbfxi X-Received: by 2002:a63:e34a:: with SMTP id o10mr8856059pgj.130.1643920288223; Thu, 03 Feb 2022 12:31:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643920288; cv=none; d=google.com; s=arc-20160816; b=afGIFeLBGViLyMmfShaZ+Y4bGqWKabZ/9byGVZMKlqS45HarUxq9st3rgDLmxEFMkb y1/3bmG1Q8/a/pmhfKT635GemOGXJZMqUnI0C2rPrwdUol1am0t/DOjRv168eTSsItJ2 2NMvzOKbuvRJ+FdjUbfJeyOh9b9EYpEX5B+15aqOZdbdTF0bkDmOgA2Ohgc/BJ8Zk3UZ saIHoKFz0K7FhY5j0vRfglXx68jx4qJNhXn47+k1ev+BFLswYcyk7GUEcyfehXdus6v8 byAecIM/quAzJxt03h4WHTqTzV1DklgZGqWnnxNwUgPFGe6sCw5/QC4jGhT1HLsCK4JY iE+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=jqAqje5Zj84wdSfPab7632bbR/B0kDwUhgr33BrLD1A=; b=irttOa9rmcNEcIQyq+oSdQOht+ObKGiHTdpBTOGvTMYHp2FkKl9MlKdhhWHn7JrgWC PPv4AmpziQV8Xgqhl8reUNAza6rlhjG4UBeHfgrr4yZF0W8hk/1/an1pL4FvkcVHHoTz ZwmoUBW6uhyFAjKK60M/mHNIhj5U3+NwEZ7BZk+jOFflRD2TdSHeNvr4EBkj1bs/qcji aDmTPfyest5g+nG9Tnfs9CzdWdhc2w4uI28yFv/MO09tLKw87mcp/goNaE5JNoFxe0Rh uWY/sg/fme20hy7oNRz3xZhR6rNbybUagHzkXTjZ3tPsyKDN+cO1qLO03eAzfiRnbH+q CWZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WEV1GWOw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18si25426576pfu.290.2022.02.03.12.31.16; Thu, 03 Feb 2022 12:31:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WEV1GWOw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232726AbiBBOKL (ORCPT + 99 others); Wed, 2 Feb 2022 09:10:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:52032 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbiBBOKJ (ORCPT ); Wed, 2 Feb 2022 09:10:09 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A7017B830F5; Wed, 2 Feb 2022 14:10:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FBCAC340EB; Wed, 2 Feb 2022 14:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643811007; bh=6uznsR4H3yFEQiaP1m7THbQ2MOu1Lo/N213pW2a1JJY=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=WEV1GWOwYGozfq3wU15ekgvJTOvdsgSPY/6lUN4aU02JNoheDkT2IhXaDaT/X85ny ZZvZTlwsNBcN7Tsl58q2ngqPNEalQg6kN/QAiwk8n7elVGe7ToMfMq1b/0kdFwrz8B RTvl9ZWvL+dj+uX/4YX/v5TPVaH+BWmrUcWvZgeXlq56zknzL5PYEGa6BaHoSfpEqR YOL0cqH0Oh0hFSQ9UxgALB1X6pwTAQLtooj+iFFqsmWBKBdgAoD+Cw98MyNZ8ZOtfr CIcwDdx5CbS0OVkWaHhEbRnUpLkZwzGlUmM4rW+q+EBtPW522AFSAxqyEe9lyXOfUM JuxspxCupXCcA== Date: Wed, 2 Feb 2022 15:10:04 +0100 (CET) From: Jiri Kosina To: "Gustavo A. R. Silva" cc: Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] HID: google: Use struct_size() helper in kzalloc() In-Reply-To: <20220125233744.GA81239@embeddedor> Message-ID: References: <20220125233744.GA81239@embeddedor> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Jan 2022, 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 or integer overflows that, > in the worst scenario, could lead to heap overflows. > > Also, address the following sparse warnings: > drivers/hid/hid-google-hammer.c:61:23: warning: using sizeof on a flexible structure > > Link: https://github.com/KSPP/linux/issues/174 > Signed-off-by: Gustavo A. R. Silva Applied, thank you Gustavo. -- Jiri Kosina SUSE Labs