Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4674939rdb; Tue, 12 Dec 2023 06:28:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEP4Nd+9uSXT2DHmYj/TFpU7hqXYRhthzfs1hQAJsrmFYEf29cYgy7UQoqUt1WkuuCexkBI X-Received: by 2002:a05:6e02:1a0f:b0:35f:6a71:9315 with SMTP id s15-20020a056e021a0f00b0035f6a719315mr54461ild.23.1702391289269; Tue, 12 Dec 2023 06:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702391289; cv=none; d=google.com; s=arc-20160816; b=InL9ZddrPliVbNJ8INUc/hJ79sysBVdmBzW0BaTgtzabJ8yF94erpeHVYWAz18al0f WCma+/ocAa0AiniWREBMpDDTqjXmNXx3RBsA5m5AydD0ZxXFLwfNMj/8/fv7/o3OSvC6 eAau5jC4VgXpjq+yRMdTyWS1XBjAQmz0vPZvyglWKn148pdvkMWkgoUSdzIz0GxUPNmL 6iz5+xmcFeCtnfHH6f5g/5Ci6aTdqitKvzVGaaok8ZO1u7aA4sMNfX7M365TnTvlZc7c igGQU/sBJcHRgtyXE6uCcVbiJAQUP078NMw/6bPxK6y8kqaVi3luOal8jUs7W0ZX2K1w 8Qzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Y5U/p6WhUwXmNbgop0UOPNRNBLfb2DEBWeLZPZx9Wi8=; fh=v6ziBsf9nFTBFSC4ZzyAYKlPTmmSf3uPARN7i3Of7PU=; b=JLwsgBux7SHo6oRKdc2aiJogMqPiQ18VeO15EAY4Z51/32kuObrmgvDzPya8Ulohq9 qOvnNS3HbX4rsE8EHgvHZ+17q6VqN1s9NrrcuAT5fKt2R6OEeyc1rcSW0LPB2VeB5a8c w4ZkKWXpeqaG7u6sk3GIWh/9DYEdKWmtYz1tSwDsuqWAyWaaCte1eoe5R7iBvLdpjZ04 Scrawj+Per5t1YNeu4YvHKiQlb0wtl5bTlUSPnkJl+sEs4ieJUSow5a9mcH19Snx6emj by/2zP8lTF6oV3FeVKQfqW0/xPoO0YO+itdM2R3Lk/DVXcpVW0uriLhSRnKz7FagYEV+ VpTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=at9vmyc4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u1-20020a6540c1000000b005ac8d44bad4si7514235pgp.592.2023.12.12.06.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 06:28:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=at9vmyc4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id EC8C5803EBB2; Tue, 12 Dec 2023 06:28:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376609AbjLLO1n (ORCPT + 99 others); Tue, 12 Dec 2023 09:27:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376800AbjLLO1l (ORCPT ); Tue, 12 Dec 2023 09:27:41 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1632AC for ; Tue, 12 Dec 2023 06:27:47 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-28acd29cab3so251836a91.1 for ; Tue, 12 Dec 2023 06:27:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702391267; x=1702996067; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y5U/p6WhUwXmNbgop0UOPNRNBLfb2DEBWeLZPZx9Wi8=; b=at9vmyc4O+JIleXHXiP5KhLV9XRYQRSWIV6CPOSSNCdRzVqfQGjs/WEDUPQUgjUv4x Dbq6m9AxKV397cmFWC4RVCWb7QZxEbys/vcN/xgLlVMCO+yLx6hawZFJI1M6aCh+ugyl rjB5eU0p7Bz4+NUULGehMd/BixsCZ1LxEQslWVNCUvhZUZ+7v9hYrAX5JXZbJgrsZxtu rfkgJ87CPeLoSf8ToSH2cwDRtWZBnXrnZ3bC/LYojJaNCXGKDFWK4q8ZtWyDe01f9oUh /D0Duz3bHTcC2m4HeZFM2+nC7BkAKPoODlrSdXgy+I/A8rOVU9H6QsDztVYFqAlxvoi/ 6YpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702391267; x=1702996067; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y5U/p6WhUwXmNbgop0UOPNRNBLfb2DEBWeLZPZx9Wi8=; b=ZzA8xaWgY4rsFt2/WLKcT/7w0Qylh3KnrJURqjbYBp0NNWb9hgLnx1y40TLBSpz4Tn 65paHu3TribfwhgVVc3VuGDfAZiSSxYOh1AXrb9rccoAe18fI0LSeyjzhNUUHa+uIag6 /pCKyQEXBtLqrHmYrLU8OClkQu2UmsYV3NHO99O9aVxxzObX/Sa0sAO2+wg1BDf6GISY snKTeC+YuXdfVXLDpizyWOKefBDDEI3jLyTYaI0yJzfsRa5fsDA7j4SFmUfUcEASaLXe xTC+t+mUVQ2cQz59yw4bulNjkEMhEPXWnchAaGjYoGBo7oOVwo1wSV8wpYkFoyZnK1Bn H9+w== X-Gm-Message-State: AOJu0YzPfC/Lq3QnceVP584jNjwBc9gYjZlD9B6P0BBPlENcZffixM2J H+0K+FP9QiXcZtPRtyuACgbFByHl3bo= X-Received: by 2002:a17:90a:702:b0:286:db1e:f8fc with SMTP id l2-20020a17090a070200b00286db1ef8fcmr2877105pjl.92.1702391266731; Tue, 12 Dec 2023 06:27:46 -0800 (PST) Received: from code.. ([144.202.108.46]) by smtp.gmail.com with ESMTPSA id pq18-20020a17090b3d9200b00286dfa09e7asm9156648pjb.24.2023.12.12.06.27.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 06:27:46 -0800 (PST) From: Yuntao Wang To: linux-kernel@vger.kernel.org, kexec@lists.infradead.org Cc: Eric Biederman , Andrew Morton , Yuntao Wang Subject: [PATCH] kexec: Use ALIGN macro instead of open-coding it Date: Tue, 12 Dec 2023 22:27:06 +0800 Message-ID: <20231212142706.25149-1-ytcoode@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 06:28:07 -0800 (PST) Use ALIGN macro instead of open-coding it to improve code readability. Signed-off-by: Yuntao Wang --- kernel/kexec_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index be5642a4ec49..0113436e4a3a 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -430,7 +430,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, pages = NULL; size = (1 << order) << PAGE_SHIFT; - hole_start = (image->control_page + (size - 1)) & ~(size - 1); + hole_start = ALIGN(image->control_page, size); hole_end = hole_start + size - 1; while (hole_end <= crashk_res.end) { unsigned long i; @@ -447,7 +447,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, mend = mstart + image->segment[i].memsz - 1; if ((hole_end >= mstart) && (hole_start <= mend)) { /* Advance the hole to the end of the segment */ - hole_start = (mend + (size - 1)) & ~(size - 1); + hole_start = ALIGN(mend, size); hole_end = hole_start + size - 1; break; } -- 2.43.0