Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7909745ybl; Thu, 16 Jan 2020 07:35:31 -0800 (PST) X-Google-Smtp-Source: APXvYqx0S+E1UEKnxUt6h5cxP+QU2fpLRQ0lr1p3T8D4ke4HfNMvid5pKhoBBfsHsH+c353sublv X-Received: by 2002:aca:31c8:: with SMTP id x191mr4321159oix.25.1579188931571; Thu, 16 Jan 2020 07:35:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579188931; cv=none; d=google.com; s=arc-20160816; b=u0rrXjeEBwVWdYHnC7UY5DC+K0Ts22rkNVixp76hPNGfI+NilV6iJeCDx5XKixnnNl gcLZbPgz8yBwNN+NZKJL5f403bBVVR3WIK9a1oCCPsobR67MZIqW1fCEXZ0yvzk+2dun H5w8CJgKIQ/Ga8RiwKWz0toI25CweXYPor0S5LuKuycyfA1/+4xola4lbBZM9+Z17U15 SGe82s9FOqIimOMYUAojuKGkpIjCaZYukX2r4C7l3pBEZB1vQ0DXuimHftIICbXYTu9w IhyJjkl1pooP6oqquvJYX0q61oQG5p8cr8IcZFLY/FXaz5pE5QLStA9yvOt/c/NmsiVo /HEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=l/wzX22rfsXNzsGgedZf45CfXWCFu1BWVyW+NZhSBCM=; b=SfZLvUVhIJkX1TAANmVk1iP8/fOqMaWnK5Yrgo5N4H9C5c5Q+eXNujvTqABsydJfh5 XcTL90ud0vhaEJrT6uBI7cjJDEnpko5BRCW9clPkS7l/pNoNJOnQXY5mycDdT7/ucoYZ ncey8jCTu8Paz9GyUSz4jHEYAA+Ej+FX6k8Hp0oKNw4d1GQkCBl/hHpKjL6l7ESCJqRV rohtJFfaM1qC9PcxnRqBuOsUwEBqI4W9w+YfufhcGn09BpA+kpPwsqLpMc9rEfZSPHrb fRZZAsKDRf45dDpGoZWRdnYZ7/Kjz7ADY2Wu3lhue6PZFAqfA1kSeaVkQn4WdX0ZOA+h ZTIQ== 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 s19si13907117otd.9.2020.01.16.07.35.18; Thu, 16 Jan 2020 07:35:31 -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 S1726890AbgAPPcN (ORCPT + 99 others); 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