Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp122893rdb; Tue, 16 Jan 2024 17:48:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGeBi61jq6KdN0MlKRn8jn/ykut0fVDboYsSfWEYBTD/YwmZUtGdsbwwElfJmojpLxxNADe X-Received: by 2002:a17:90a:bc49:b0:28e:7b77:d1a8 with SMTP id t9-20020a17090abc4900b0028e7b77d1a8mr122463pjv.30.1705456094584; Tue, 16 Jan 2024 17:48:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705456094; cv=pass; d=google.com; s=arc-20160816; b=DznKREyXxoBLvRLUM+u3B4d+GT57eW8BZvhK+jK9iYegWLGvmEl32VItQzvBsLTyxG 1Dxg5gBIGeYz6OgRcTH1ax6QV2qhOflbOWn0ex1vSbskxIE/OBmB18qkL/8NqehykPzH jEgidtknRHSv7jtm9p/6VqlCCAcM2pkFgMftL/Vcnf1FIsr/HEDKgUBqina/tJzhqpqE vWXOHHqkNPGWzNX/Qho6DfAeUicOQeIa2Aym1Ba3DC7W34U5FlcOSfgFtfEnyai5eShE 0kHDAB3vURD/RQZiaOyHAkHK9LKYjrdwKYhuqi4qYEj36HtGTbHeyYu5zO3MEkCwPO9f r8vA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=k2mMSx3p66qkIv+hxwAyS0/xlBSMxzpJm1gO3ZSBmco=; fh=UUTFhOqf21p8QAOraSnblS9+XnpUKqYmjOQcUaSN6/c=; b=iuk7/zuI1WPXR7YuhuQ++YHV7aqc7X/TyXg/E7dImC8kWfpj2mQNfZQvvR1ThKFDdD gQLXNOKlR2sXxylFJ4YDVgsZZDGbwEfnNkIAocj9E2YwT+O4rN3KebvLqvFOZkCWqG8/ uPuvWYw+mN3wouUQK9OzGDqaCODOSFxPCtsiH68JY4MnvJTBLyOWhGL/+doO6dJVkun9 3c2NOVJr8KEGZMsQcdFN8WL2p2b8yKHwQ4I0JNRWMjqr97TYhodPMW+ewfixjy0RVxld quBb7LDiWZQc0tAIHZ8hA9Z+oXpLd6tYiI+4taK+t9oE93eSN5/mYNeG5VEL9QEIqr53 /yjQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-28440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28440-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bx20-20020a17090af49400b0028ddce5384csi12163492pjb.157.2024.01.16.17.48.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 17:48:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-28440-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28440-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id ECF99288467 for ; Wed, 17 Jan 2024 01:46:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10A4F17FD; Wed, 17 Jan 2024 01:46:05 +0000 (UTC) Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA9081864; Wed, 17 Jan 2024 01:45:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705455964; cv=none; b=AetgyY0t5dXtJKL3zqw/blDihMWkB+G1ZEBaKNT9gkX6gvYzQTbjHE65FWNcSaXz1ceonvhrk+OOkn7gmEGsGrmOB3C8OInC3yftU9klf6804yWnmbnJ+Z4z5dpIRhnm9GUrYI+w5+35gPGMUthlChFinDLSmk78sTmrNpaJEdk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705455964; c=relaxed/simple; bh=fgPwF9xhCsHvun6QMTgmDHGlC69r9M6BgvAyZFblfY0=; h=X-UUID:X-CID-O-RULE:X-CID-RULE:X-CID-O-INFO:X-CID-INFO:X-CID-META: X-CID-BVR:X-CID-BAS:X-CID-FACTOR:X-UUID:X-User:Received:From:To:Cc: Subject:Date:Message-Id:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; b=PR8HAIYk76xkzgZSgTwbwKg1Nzv9Ap2y2z54sM6KvRJOfvqkydPwGp8RN11gIw7YdkzW9SjsQL0g365WXzXANWdJf9EZ7q6JlZKFAF52ggRZEWI9KT5DT7rB0JFOr04n7gck1H8bnoCaBIIYGkc+6q8Zk5+2Bt6Rq5EEbK4aJ74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 711b0d93f1fa43b4b0a2a28e58723e95-20240117 X-CID-O-RULE: Release_Ham X-CID-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.35,REQID:003e1394-ef5b-4aef-aabe-c69c16c4d8b7,IP:5,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-10 X-CID-INFO: VERSION:1.1.35,REQID:003e1394-ef5b-4aef-aabe-c69c16c4d8b7,IP:5,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:-10 X-CID-META: VersionHash:5d391d7,CLOUDID:00573e2f-1ab8-4133-9780-81938111c800,B ulkID:240117094108WJOCVTCR,BulkQuantity:1,Recheck:0,SF:38|24|17|19|44|66|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:41,QS:nil,BEC:nil,COL :0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_FAS,TF_CID_SPAM_FSD,TF_CID_SPAM_FSI,TF_CID_SPAM_SNR X-UUID: 711b0d93f1fa43b4b0a2a28e58723e95-20240117 X-User: yaolu@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 298752770; Wed, 17 Jan 2024 09:45:49 +0800 From: Lu Yao To: paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Yao Subject: [PATCH] lsm: Resolve compiling 'security.c' error Date: Wed, 17 Jan 2024 09:45:41 +0800 Message-Id: <20240117014541.8887-1-yaolu@kylinos.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following error log is displayed during the current compilation > 'security/security.c:810:2: error: ‘memcpy’ offset 32 is > out of the bounds [0, 0] [-Werror=array-bounds]' GCC version is '10.3.0 (Ubuntu 10.3.0-1ubuntu1~18.04~1)' Signed-off-by: Lu Yao --- security/security.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/security.c b/security/security.c index 0144a98d3712..37168f6bee25 100644 --- a/security/security.c +++ b/security/security.c @@ -792,7 +792,7 @@ int lsm_fill_user_ctx(struct lsm_ctx __user *uctx, size_t *uctx_len, size_t nctx_len; int rc = 0; - nctx_len = ALIGN(struct_size(nctx, ctx, val_len), sizeof(void *)); + nctx_len = ALIGN(sizeof(struct lsm_ctx) + val_len, sizeof(void *)); if (nctx_len > *uctx_len) { rc = -E2BIG; goto out; -- 2.25.1