Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5116901ima; Tue, 5 Feb 2019 06:39:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IY5RDzCt8DAAcgFJE097UYWEq2S0X0iYaYHYHVb32383tF7I6HEd/J7Qz/AsTCAg24Z0K+U X-Received: by 2002:a63:1e56:: with SMTP id p22mr4905714pgm.126.1549377586773; Tue, 05 Feb 2019 06:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549377586; cv=none; d=google.com; s=arc-20160816; b=X5BQV/MPa73URLXviyEsOUSVM99b38iaAfwdufeFMdj5fU/zO5IDpzXjpPm4rOOYPa R55fxyfG4znPltcrMhMMA6+TMisfK2AjOYw8dFKpFWChH2ll0srNSHMYzqfK2+XV+/X7 GikakI6r3RsTqTSzu7ZtaxAdd72ZmsKmJW2G7ZAoYqhULqi/APt3xyhEcv1P2dIH57Sm PaLQ1GtmO0OcB6V0H22hynA/+knRav2qWC9Cg8eUnONJFJRsAPWuAoojmI86J2Q2Hbk7 aFRaTbV2X5iXy/sYF2kMVPvUKETD3lm3zt/MbwBMqAGPC5KwLPI27dsYPzKeBnPBB/5a 1Cnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=LXY97sQZIqVPVwZf5V8tWxPz3gzUeDOGZcp8FHM/4ZI=; b=Y/BpiLA9BVR6YuRyNRXpgdeMkmCUiQo/s1gE2lL+KhKZ9RzX06vmMDukagCv6vpMzl ilrwOigaz0aDVrXF71SULtZ/ZcOFTZIDPNVxIeqwk0f1P5L8nN1fL9HAha0oU8ulMBTW hqNa50XlkQY62IND5VHLC6x4HmBfJKATmMFdKw6E5kiSgCMZ4uxKSxSjQgob8O9mC0CV VKrB8/24BSaXbkQcb7xEPv/eTmteTRRwwd+Y7R8VZdsIjBDT5X+dJYeCwFAiegc9EynR J497HKh2o55N3N3XAeKgZEPcPNcKkqklIEgs1mFkfCKKuadA8VSnQVi0s8t5EnJLyBMc SWbg== 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 v7si3362737plo.12.2019.02.05.06.39.30; Tue, 05 Feb 2019 06:39:46 -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 S1728623AbfBEOTA (ORCPT + 99 others); Tue, 5 Feb 2019 09:19:00 -0500 Received: from mx2.suse.de ([195.135.220.15]:47944 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726276AbfBEOTA (ORCPT ); Tue, 5 Feb 2019 09:19:00 -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 00E3AAF7B; Tue, 5 Feb 2019 14:18:58 +0000 (UTC) Date: Tue, 5 Feb 2019 15:18:58 +0100 (CET) From: Miroslav Benes To: Petr Mladek cc: Jiri Kosina , Josh Poimboeuf , Jason Baron , Joe Lawrence , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/4] livepatch: Proper error handling in the shadow variables selftest In-Reply-To: <20190204135653.31406-4-pmladek@suse.com> Message-ID: References: <20190204135653.31406-1-pmladek@suse.com> <20190204135653.31406-4-pmladek@suse.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 4 Feb 2019, Petr Mladek wrote: > Add proper error handling when allocating or getting shadow variables > in the selftest. It prevents an invalid pointer access in some situations. > It shows the good programming practice in the others. > > The error codes are just the best guess and specific for this particular > test. In general, klp_shadow_alloc() returns NULL also when the given > shadow variable has already been allocated. In addition, both > klp_shadow_alloc() and klp_shadow_get_or_alloc() might fail from > other reasons when the constructor fails. > > Note, that the error code is not really important even in the real life. > The use of shadow variables should be transparent for the original > livepatched code. > > Signed-off-by: Petr Mladek Acked-by: Miroslav Benes Miroslav