From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08B43C433F5 for ; Thu, 30 Sep 2021 18:00:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D4C4D619F7 for ; Thu, 30 Sep 2021 18:00:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352962AbhI3SCf (ORCPT ); Thu, 30 Sep 2021 14:02:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352958AbhI3SCe (ORCPT ); Thu, 30 Sep 2021 14:02:34 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFB8AC06176A for ; Thu, 30 Sep 2021 11:00:51 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id il14-20020a17090b164e00b0019c7a7c362dso2269022pjb.0 for ; Thu, 30 Sep 2021 11:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GvInsCJfgVIdu+bTl+EZcCSDBMnOYdIPFiEnPSEGWq8=; b=C+AhbK8OmIghCqB38Es9+sqV5ZiplbGylDANFPGzeGsstzb+vKsJgLrMKcqsXrj+Ls E51vKRIr5y+WbmZvxZVTas6LticTYRZPHvE3mTOcmA5do+nsSSV1iTn7ls4F2BlhqLym CVjOo2cReN5XP3kuUARBo3Iiap96FHW4NnrJM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GvInsCJfgVIdu+bTl+EZcCSDBMnOYdIPFiEnPSEGWq8=; b=m1kV+fTCXMZHP4PFEX/6s4v9rDsYBVjeRIAqZYSnSy/tJ5IdTeaoy+Fdz8aohzaM09 HHzajZE5gjpVr9mF+gQj9Okpr/jqWd0YaTq0ez3nsHYO+vr1+zPvxM3OH7vhBbYZK6Oe 8R8IJyjbQSWwaCnGiyjV3uFlx83ogy68jqWqgBud3R1o3hpch6txaDwPjEEGJMLicERQ Yw7xCbcEvGMCO19FHd1XemnpRKYTai/iiORUqAxRxKWNPHo0UYft8tTT48U78+6ZGvZj de8RG9Jx5musygK3wU8N7SRfxriWiWnqeo57pgU7RUAOPHtx0JNGOGvLA0ixLicDtK4s 6ZiA== X-Gm-Message-State: AOAM530YQs2dzxaxhY1BqAAsDsjwbfuwCFdlMQEh/Vf0tlyeb18zytmF pwp/ZfpCK2prunEHNxFWmIXlYQ== X-Google-Smtp-Source: ABdhPJw1x/cuO9mw2pkpxFtvuHlojDjhxrcg02FFcSXPI1A/yf4JspLL4WFzVx/lrn2zgGEudX2AQw== X-Received: by 2002:a17:902:6ac7:b0:13e:1fec:2bbc with SMTP id i7-20020a1709026ac700b0013e1fec2bbcmr5413917plt.82.1633024851430; Thu, 30 Sep 2021 11:00:51 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id k9sm3628222pfi.86.2021.09.30.11.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 11:00:50 -0700 (PDT) Date: Thu, 30 Sep 2021 11:00:49 -0700 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Vinod Koul , Maxime Coquelin , Alexandre Torgue , dmaengine@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] dmaengine: stm32-mdma: Use struct_size() helper in devm_kzalloc() Message-ID: <202109301100.2BB00DE96A@keescook> References: <20210929222922.GA357509@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210929222922.GA357509@embeddedor> Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org On Wed, Sep 29, 2021 at 05:29:22PM -0500, 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 worse scenario, could lead to heap overflows. > > Link: https://github.com/KSPP/linux/issues/160 > Signed-off-by: Gustavo A. R. Silva Looks right to me. Reviewed-by: Kees Cook -- Kees Cook