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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA0D9C33CB6 for ; Thu, 16 Jan 2020 15:32:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79E872072B for ; Thu, 16 Jan 2020 15:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726908AbgAPPcN (ORCPT ); Thu, 16 Jan 2020 10:32:13 -0500 Received: from mx2.suse.de ([195.135.220.15]:53726 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726151AbgAPPcN (ORCPT ); Thu, 16 Jan 2020 10:32:13 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 25F136A2E1; Thu, 16 Jan 2020 15:32:09 +0000 (UTC) From: Petr Mladek To: Jiri Kosina , Josh Poimboeuf , Miroslav Benes Cc: Joe Lawrence , Kamalesh Babulal , Nicolai Stange , Dan Carpenter , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Petr Mladek Subject: [PATCH 0/4] livepatch/samples/selftest: Clean up show variables handling Date: Thu, 16 Jan 2020 16:31:41 +0100 Message-Id: <20200116153145.2392-1-pmladek@suse.com> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dan Carpenter reported suspicious allocations of shadow variables in the sample module, see https://lkml.kernel.org/r/20200107132929.ficffmrm5ntpzcqa@kili.mountain The code did not cause a real problem. But it was indeed misleading and semantically wrong. I got confused several times when cleaning it. So I decided to split the change into few steps. I hope that it will help reviewers and future readers. The changes of the sample module are basically the same as in the RFC. In addition, there is a clean up of the module used by the selftest. Petr Mladek (4): livepatch/sample: Use the right type for the leaking data pointer livepatch/selftest: Clean up shadow variable names and type livepatch/samples/selftest: Use klp_shadow_alloc() API correctly livepatch: Handle allocation failure in the sample of shadow variable API lib/livepatch/test_klp_shadow_vars.c | 119 +++++++++++++++++------------- samples/livepatch/livepatch-shadow-fix1.c | 39 ++++++---- samples/livepatch/livepatch-shadow-fix2.c | 4 +- samples/livepatch/livepatch-shadow-mod.c | 4 +- 4 files changed, 99 insertions(+), 67 deletions(-) -- 2.16.4