Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5178973ybi; Tue, 28 May 2019 08:47:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzahlu5gNqm/9l1G0GTx1CHNRv7xeSphyPnvJZuhVF3oypDBhvihVmSO0iazXyniqzgC6bU X-Received: by 2002:a17:90b:145:: with SMTP id em5mr6558267pjb.35.1559058472180; Tue, 28 May 2019 08:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559058472; cv=none; d=google.com; s=arc-20160816; b=zoUvGx9zOAwPrLI98Ra13hhhyCexBFwZK6PF24Zmh8sA+fzYzIXrIOq1Lus2Oul+r8 BcGTSjisZW/OYm+LOi9zdWWQCVoWT9V/zk6ONvfawF8VSP/0ih11SnbhVwubkrFQ3iGK 8IezB4Tpot/hpLvWSjCoWukAWYEMunvCizDIXxukpO9AMQCPtjdJFEBxEmesvvYo8Gdb 9PkPDbaW1TKVMrXiP7w8/lM8ZDhO+vGB1FMj71C++ma4AXLIIGRJ9/rdMVqR1LkIAvqq m1rPlFrzcXuOPNf95yJrgUe/YQdfpe3qO7HCqH5uPobVB7/njM9mi3w9XFdMmYMVldeb fYuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=e9ezVnaqiEQoOMK0HJH9aXhELQzvNqwyvIWER1Pdfsg=; b=Y5aZFZk1fYRffhjxy568vaONtk6yF5w5tOSqPKWVwYeuE3Sdk5ZQKZqpIvZsdl4JZH kIpjuaL51H3DyPtIheZFtZh2NAhHmIDDSlPaOskpWw16Qwihy7uCNOz2KJQJM7YHXSEf OKEunevQ67Xb6+GZXB9UniB1nPheSHUT7MvS/FccsMXtZ9e7dGvBo9+VDRwrmkZuKzMD ih11huuQgvs69K90QMUQwSW87UQngaKx/zTiZ88MvIIrcdHRuatnWx+l2oRSUYQr/ngP oZOxujC0GeTauxAM1E96vU5/VP3ziltoV2Jx37Oqc4bFSmE7ZG+x9QnyVA186esjz8wL R+xQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4si21707941pgn.428.2019.05.28.08.47.35; Tue, 28 May 2019 08:47:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727307AbfE1PaA (ORCPT + 99 others); Tue, 28 May 2019 11:30:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:47506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726512AbfE1PaA (ORCPT ); Tue, 28 May 2019 11:30:00 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3192E20883; Tue, 28 May 2019 15:29:59 +0000 (UTC) Date: Tue, 28 May 2019 11:29:56 -0400 From: Steven Rostedt To: Tomas Bortoli Cc: mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] trace: Avoid memory leak in predicate_parse() Message-ID: <20190528112956.4cf2dd9c@gandalf.local.home> In-Reply-To: <1a9137e1-bcc3-787f-267c-8b76dea41fbb@gmail.com> References: <20190528134659.4041-1-tomasbortoli@gmail.com> <20190528104400.388e4c3f@gandalf.local.home> <1a9137e1-bcc3-787f-267c-8b76dea41fbb@gmail.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 May 2019 17:18:59 +0200 Tomas Bortoli wrote: > >> + memset(prog_stack, 0, nr_preds * sizeof(*prog_stack)); > >> + > > > > Can you instead just switch the allocation of prog_stack to use > > kcalloc()? > > kmalloc_array() is safe against arithmetic overflow of the arguments. > Using kcalloc() directly we wouldn't check for that. Not really ideal in > my opinion. And there's no kcalloc_array() apparently! But doesn't kcalloc() simply call kmalloc_array() with the GFP_ZERO flag? -- Steve