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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A32AC433EF for ; Wed, 8 Dec 2021 04:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239900AbhLHE6u (ORCPT ); Tue, 7 Dec 2021 23:58:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233743AbhLHE6t (ORCPT ); Tue, 7 Dec 2021 23:58:49 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60CCDC061574 for ; Tue, 7 Dec 2021 20:55:18 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id gt5so1100152pjb.1 for ; Tue, 07 Dec 2021 20:55:18 -0800 (PST) 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=cNfiJvO3fejBotE5iySezNhtEJJwER74TgDA97YhjHw=; b=dFvbWj1YTb2rkTnoh4vumG6c98xkqmedsvStrzVGBcOXL5hS1P5l1JINBDvAe4CWYs C56jIevPqd1PVb3iikh9OpUZjBNpFhNIf2ZOp6sBPFhhVkk/Y9HyfWCJKJ7Zxsg+jYgr j26v5mM52Dd72VrH2kqFsdsH+aEdxKoaZ3JAo= 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=cNfiJvO3fejBotE5iySezNhtEJJwER74TgDA97YhjHw=; b=u8ERxtkxrWx/G4HBI5GB5TFFra6MVu0/4nS/DDxmRhRNdOkD2a51lhCJQ9dfhf2y2Y UFuhTMvxIDI3XzkAHw0zxKJe9XFBjs4SXNz8g2Krr90LTWIIbZIfIrZ8GCv6Rgu7VBKs 9L3BKlsX0CB6LlE+cdllZedi0LkL/DLOysYMe/GWisUvIvAvk1bUDGL6hgakkJLGQ1QX PjmZ68hthAaRf4CUYBusHSIMFnf0vDBjcNgROBZz4OwQOOeqY1tmmY5wuCLkR6yXkI92 c9+gCaElHSKV658M+MIRAJAgYYg4IAxt65fa6Zg82lNVCTFdXhwhf0z8GMPloOPW66Mk TnDw== X-Gm-Message-State: AOAM532NV5HEIxI7vSahKSudcrlKOElG0u9oV8AWJbAqxAcfKcLlob4W KAqZ1ENuDD/1tJnhIWSUlXRuzg== X-Google-Smtp-Source: ABdhPJzS2d4ffr4Pk1pU3l5zZk+LeQbBGpywoHPpAOS/5wf7KsRFrJSCYOl6vgYqGytySqvqn2Y0Gw== X-Received: by 2002:a17:902:860b:b0:143:87bf:648f with SMTP id f11-20020a170902860b00b0014387bf648fmr56650710plo.11.1638939317886; Tue, 07 Dec 2021 20:55:17 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 16sm992605pgu.93.2021.12.07.20.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 20:55:17 -0800 (PST) Date: Tue, 7 Dec 2021 20:55:16 -0800 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Ludovic Desroches , Tudor Ambarus , Vinod Koul , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] dmaengine: at_xdmac: Use struct_size() in devm_kzalloc() Message-ID: <202112072055.3708E99@keescook> References: <20211208001013.GA62330@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211208001013.GA62330@embeddedor> Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org On Tue, Dec 07, 2021 at 06:10:13PM -0600, 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. > > Link: https://github.com/KSPP/linux/issues/160 > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook -- Kees Cook 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DEBB0C433EF for ; Wed, 8 Dec 2021 04:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QF4ecmbZSXGvmE3AvslVFx7u+harh7wgV32KvXIGhoM=; b=DNKjEXWKqj2zY/ wv4d7hx8V4QUOIKV7Gw77T9U3/+7NORcxoMUrexrrB6LBdWpUJ16rtrkvX1aDIZaGErmtlj0PxXWj /kCncclGaGzbqgTU10xUk3u0GXukiUD0jUx+P5jz/zxEZ9Djc8k7DFD3wXoXgTe+edTO6xSKvywuz VzH4UDWBasuWDS6RwITpqJYK2ywW7yZBGfb5Wio4p+NW+l2JQb/kMapumR8BjZac6beHj/N0+mN00 KwrTo8yVtYoMCaHWfiAljYd1p0ea0Tc3h5GHydmPSXr25Dus0zvXi/NeKvHYQsodkMtOI2qJcg+Xj ZAXImbsr1B+9o+V+uLZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muozE-00BHGc-4m; Wed, 08 Dec 2021 04:55:24 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoz9-00BHFD-GE for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 04:55:21 +0000 Received: by mail-pl1-x631.google.com with SMTP id v19so761088plo.7 for ; Tue, 07 Dec 2021 20:55:18 -0800 (PST) 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=cNfiJvO3fejBotE5iySezNhtEJJwER74TgDA97YhjHw=; b=dFvbWj1YTb2rkTnoh4vumG6c98xkqmedsvStrzVGBcOXL5hS1P5l1JINBDvAe4CWYs C56jIevPqd1PVb3iikh9OpUZjBNpFhNIf2ZOp6sBPFhhVkk/Y9HyfWCJKJ7Zxsg+jYgr j26v5mM52Dd72VrH2kqFsdsH+aEdxKoaZ3JAo= 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=cNfiJvO3fejBotE5iySezNhtEJJwER74TgDA97YhjHw=; b=0DhtYcVDv6gpUV+FbI+YOMPp2ZdDLxH8c1MLL8/zCLj5Ju9HJ35mxrM5j/Ls7yTZIB CedMuSq0NMHyT5wR0/iBdyZENna9QKA7Ypk0ointTQ9jUa8CFLWcb+2WLcuz9dVJIgtr t2Qlfqu3ABWSPvJrlrflF4+TLe8sXRnEtsOCVne+0ZNFTl4DqhJkTdkSzxh6k9w9HOBA fkIIJCIHk0xi0vmVyjIGPJ2NeeCkF+tYTd0z235xJXIKPbEe20WjJNODv/28AjN4ZGC1 5KwoH2+V4yoRtQ3fcZa7fX0kTe48iNmFCI/fM1YyhyzL9wYEZnYThNFocgig801wCJlt wFMQ== X-Gm-Message-State: AOAM531GRtqo+8GQk5QEl5VRz9SCtmNC2FU9GzNFkQqoGhWYTpDnL2wG YCytCa8XP0BaNuHWboetcZGfFg== X-Google-Smtp-Source: ABdhPJzS2d4ffr4Pk1pU3l5zZk+LeQbBGpywoHPpAOS/5wf7KsRFrJSCYOl6vgYqGytySqvqn2Y0Gw== X-Received: by 2002:a17:902:860b:b0:143:87bf:648f with SMTP id f11-20020a170902860b00b0014387bf648fmr56650710plo.11.1638939317886; Tue, 07 Dec 2021 20:55:17 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 16sm992605pgu.93.2021.12.07.20.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Dec 2021 20:55:17 -0800 (PST) Date: Tue, 7 Dec 2021 20:55:16 -0800 From: Kees Cook To: "Gustavo A. R. Silva" Cc: Ludovic Desroches , Tudor Ambarus , Vinod Koul , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] dmaengine: at_xdmac: Use struct_size() in devm_kzalloc() Message-ID: <202112072055.3708E99@keescook> References: <20211208001013.GA62330@embeddedor> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211208001013.GA62330@embeddedor> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211207_205519_588773_70A76889 X-CRM114-Status: UNSURE ( 8.99 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Dec 07, 2021 at 06:10:13PM -0600, 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. > > Link: https://github.com/KSPP/linux/issues/160 > Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel