Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752439AbdHRUZp (ORCPT ); Fri, 18 Aug 2017 16:25:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51022 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751643AbdHRUZo (ORCPT ); Fri, 18 Aug 2017 16:25:44 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C5847883C7 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=joe.lawrence@redhat.com Subject: Re: [PATCH v4] livepatch: introduce shadow variable API To: Petr Mladek Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , Jessica Yu , Jiri Kosina , Miroslav Benes References: <1502740963-31310-1-git-send-email-joe.lawrence@redhat.com> <1502740963-31310-2-git-send-email-joe.lawrence@redhat.com> <20170817140545.GF601@pathway.suse.cz> From: Joe Lawrence Organization: Red Hat Message-ID: <461bd75a-c1bb-e616-c9af-83b969df7344@redhat.com> Date: Fri, 18 Aug 2017 16:25:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20170817140545.GF601@pathway.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 Aug 2017 20:25:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 913 Lines: 24 On 08/17/2017 10:05 AM, Petr Mladek wrote: > On Mon 2017-08-14 16:02:43, Joe Lawrence wrote: >> [ ... snip ... ] >> + /* Allocate a new shadow variable for use inside the lock below */ >> + new_shadow = kzalloc(size + sizeof(*new_shadow), gfp_flags); > > We should print an error message when the memory cannot be allocated. > Otherwise we will return NULL without explanation. It will be > especially helpful when a caller forgets to check for NULL. Interesting, I hadn't seen this checkpatch complaint before: WARNING: Possible unnecessary 'out of memory' message #416: FILE: kernel/livepatch/shadow.c:143: + if (!new_shadow) { + pr_err("failed to allocate shadow variable <0x%p, %lu>\n", Discussion thread: https://lkml.org/lkml/2014/6/10/382 Think the stack trace that the memory subsystem would emit is good enough, or would you like to see for debugging purposes? -- Joe