Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp618827imu; Wed, 23 Jan 2019 02:37:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN46d8pNDXoXrEa/UXQd5LONNNVSopBL9WFKOekX3rH1J/al6MAoogO2cMGrZeeo/n3NYuOU X-Received: by 2002:a17:902:5601:: with SMTP id h1mr1735421pli.160.1548239845633; Wed, 23 Jan 2019 02:37:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548239845; cv=none; d=google.com; s=arc-20160816; b=oq7dCgGYtFoEGqy3pLU1zXZurNwaOoDfxWtht0sz+qeunBjWfYaTFTFGi8apGKFj1x wZVafKHkyUTiPZXsGpGL6GueACVqKCJhLZts5gFraHK2NhFMjq5o3Ei1AIE+fogeP+nJ OJ5HmGedsGmxll0WiX87WzysShinKJyuoQrB8aJiDPvF8mSct0w5DkGFHFPi93Z7K7ZW HbsJdVPave38I3SGTa9BVBwEC/7IMiEGevCCN2jwQGDeNw5BS145Xg+D8POtq/07v2LD BXKmeXrWyVdH0nr47WofJVhZK9V0rY7FIyGT+wbUG17fcIMt0NYdkR8SJNJQ5/acOelm dB5g== 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=3MOdzenn4ZHUOJ1xBcbVZ4rEDm0Bn2tQpLW4wBS4tPE=; b=l904HZc5qXOcPtbnhNQfeF9GlFdNhUwuNSwTFV4dbpM6t1MFL/xiRVccgnwO5EW4+X aXnv/LnDCB92Qfi+R+lMrcAxBSvuu8N88GXhxG5ZUWxP/V2M6E0cnOKfxemSMr4jg3eB NduMEr6s0l7KUXzVv0k2rVeZ8njJE09jYSKpKku4iFaAWEwRTbb8oleT3lSFpTsgMbRn 3GHfEg3amMVCwZS3vXqNtdIcACVtzOZydoU0xbfAE0eXdihdDL95rGIKVDYvDyvtTDd8 8nZblibIZwfEw28wJ15GeZAndlBm5CG4pHm+fCOpt/L2/RaLVo1wYMxWcDM13MxS8nWL 872A== 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 u4si18286245pls.34.2019.01.23.02.37.10; Wed, 23 Jan 2019 02:37:25 -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 S1727248AbfAWKf4 (ORCPT + 99 others); Wed, 23 Jan 2019 05:35:56 -0500 Received: from www.osadl.org ([62.245.132.105]:46635 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbfAWKf4 (ORCPT ); Wed, 23 Jan 2019 05:35:56 -0500 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x0NAZA65008775; Wed, 23 Jan 2019 11:35:10 +0100 From: Nicholas Mc Guire To: Josh Poimboeuf Cc: Jessica Yu , Jiri Kosina , Miroslav Benes , Petr Mladek , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] livepatch: fix size mismatch Date: Wed, 23 Jan 2019 11:31:16 +0100 Message-Id: <1548239476-21110-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kzalloc(sizeof(int)) is called for an int object but then passed into klp_shadow_alloc() using the size of the pointer. This probably is not a problem as it will fit - but it should be cleaned (after all this is reference code). Signed-off-by: Nicholas Mc Guire --- Reported by coccicheck samples/livepatch//livepatch-shadow-fix1.c:97:30-36: ERROR: application of sizeof to pointer Patch was compile tested with: x86_64_defconfig + FTRACE=y, FUNCTION_TRACER=y, SAMPLES=y, LIVEPATCH=y SAMPLE_LIVEPATCH=m Patch is against 5.0-rc3 (localversion-next is next-20190123) samples/livepatch/livepatch-shadow-fix1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/livepatch/livepatch-shadow-fix1.c b/samples/livepatch/livepatch-shadow-fix1.c index a5a5cac..643ffd5 100644 --- a/samples/livepatch/livepatch-shadow-fix1.c +++ b/samples/livepatch/livepatch-shadow-fix1.c @@ -94,7 +94,7 @@ struct dummy *livepatch_fix1_dummy_alloc(void) return NULL; } - klp_shadow_alloc(d, SV_LEAK, sizeof(leak), GFP_KERNEL, + klp_shadow_alloc(d, SV_LEAK, sizeof(*leak), GFP_KERNEL, shadow_leak_ctor, leak); pr_info("%s: dummy @ %p, expires @ %lx\n", -- 2.1.4