Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp787674imu; Thu, 13 Dec 2018 04:35:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/XZeWz0v4ua/OYd+EnCfg4dJcMQY1ZhEjKMz26QLSYlq2naQTKyx+zYUyepPL5kNddX84+k X-Received: by 2002:a17:902:8f97:: with SMTP id z23mr23838798plo.283.1544704548038; Thu, 13 Dec 2018 04:35:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544704548; cv=none; d=google.com; s=arc-20160816; b=nOTb1j4zmSgb55d0/WdbBJNuLuGNYYlNSoMNGbeZiAdNIiXcV+dvskRyrJo5A4Do46 8ZN7McWDFNFxGVjcUp4ecw59WH8TTY43lLdtvtqz6m/cL+VLe0sIyWePKSqDuxsrdhGA esEbXoYZZ8jcYg5+GjZ8Z54N+/KsKW1lM8v3IBzk6VFPAHzOyD6Z3S0qhyUobnFRsr5T vx1vxPFnPpePh0Adgsgg1/KHvwcp/twkd6C8dDDQoZ3WO73lJLd66hYmg2OZuZw0sQ69 gERtnTnrywUZRwaEOt6TqTEbwEh+9PriFu1SaMNAx/5rt5BgRi5cHZgmtSfC1jl/649x MdZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=bqx3cRHEOajSJvI6wJ8PWcuzlibzKVvTRY360xg7R0o=; b=JVOdvW7Yw1m6aurSlgHvaxaOrWOj4CvS9Bwu2zEy+kLPpMmJY872HbwexLVPKHAdxe xNooXTnacaM+uQMv7qHsFZbhiUQxB4DWt9pusaANxDgSabVHSytHdldenVqqpHfM9ujF P3hhE7u+aS7lsoB4AjalOWM8WfdmJgbNkVBcyc2PzPXgpfU9TlGoUGtv+gEjhUPGj6Xf iOxnvkl6Ejty+Ili/cpkeTuAocKhi0kmw9lw0hcHAIbyNj5ois8brAkQQ2WQyUrBG6HZ ASl93GUcbNVEhGRu0rwJk99R6fvFjzcfW3UUj6VsWhMT3pl3QaONhFPvgX8fqkGkbkXG TPCA== 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 cb2si1545748plb.298.2018.12.13.04.35.32; Thu, 13 Dec 2018 04:35:48 -0800 (PST) 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 S1729126AbeLMMdK (ORCPT + 99 others); Thu, 13 Dec 2018 07:33:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:56942 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728517AbeLMMdJ (ORCPT ); Thu, 13 Dec 2018 07:33:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1D6BBACBA; Thu, 13 Dec 2018 12:33:08 +0000 (UTC) Date: Thu, 13 Dec 2018 13:33:06 +0100 From: Petr Mladek To: Nicholas Mc Guire Cc: Josh Poimboeuf , Jessica Yu , Jiri Kosina , Miroslav Benes , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] livepatch: handle kzalloc failure Message-ID: <20181213123306.g7ond2gy6vqq7sge@pathway.suse.cz> References: <1544699390-15673-1-git-send-email-hofrat@osadl.org> <1544699390-15673-2-git-send-email-hofrat@osadl.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1544699390-15673-2-git-send-email-hofrat@osadl.org> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2018-12-13 12:09:50, Nicholas Mc Guire wrote: > kzalloc() return should be checked. On dummy_alloc() failing > in kzalloc() NULL should be returned. > > Signed-off-by: Nicholas Mc Guire > --- > > Problem was located with an experimental coccinelle script > > Patch was compile tested with: x86_64_defconfig + FTRACE=y > FUNCTION_TRACER=y, EXPERT=y, LATENCYTOP=y, SAMPLES=y, SAMPLE_LIVEPATCH=y > (with a number of unrelated sparse warnings on symbols not being static) > > Patch is against 4.20-rc6 (localversion-next is next-20181213) > > samples/livepatch/livepatch-shadow-mod.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/samples/livepatch/livepatch-shadow-mod.c b/samples/livepatch/livepatch-shadow-mod.c > index 4c54b25..57d5cde 100644 > --- a/samples/livepatch/livepatch-shadow-mod.c > +++ b/samples/livepatch/livepatch-shadow-mod.c > @@ -118,6 +118,8 @@ noinline struct dummy *dummy_alloc(void) > > /* Oops, forgot to save leak! */ > leak = kzalloc(sizeof(int), GFP_KERNEL); > + if (!leak) > + return NULL; The same comments apply here as for PATCH 1/2. Best Regards, Petr