Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp236319lqs; Thu, 13 Jun 2024 08:43:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX94An2ZZeBB0IkgveHckXp4OSXXqGAth+smVgaaQ4xdhiqlIagV7V7Xz/Y9JqPxkrO1ImDxnaOg66EL9PFuOvhkObR9u2EZWwAJl5xuA== X-Google-Smtp-Source: AGHT+IGXS0Nb5sEvtBDdEyx/8t6aB/oBgxpw9w94rZSXz3ESd4nL5QU2e+Zel16m30KQbvET+GFX X-Received: by 2002:a25:4907:0:b0:dfb:dc8:a0ac with SMTP id 3f1490d57ef6-dfe68c0ddcbmr2621490276.42.1718293398644; Thu, 13 Jun 2024 08:43:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718293398; cv=pass; d=google.com; s=arc-20160816; b=WUBuC86+bkHljj1Bd6XdEbZEfw6TGaS8nFJiakCJn10i/1/Vm7TLd+Q5Yon7blJkWd FvIi1etsDd03RLcyyRLjUbdHMtVPz7m/lpC3RgXH06bx2zAQRMFbh4wYj590mnKL/3Fz EQlwCyFHcUI00cBRByKwGf8INJykjcDJ6FIEcRrdbihaYi3R0PPbz0rke4EzVg6Jc8cn d9kiXtWaQTmIQ1/T/SgcxAh22Va4LcXu2F2sZU0k/tm6BLmNppZ72C1uvvpHJRklFf6O N/k4y+0G6AVxuVgIR2IU2tmG9UcvgvJwSfa0oenTPW4EXtz21AD6UmZYOMiZDsZqxs8b 7VOQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fhyNLk4BgDYNJAsfSc8ftWCxz9OlL/4RiKPE6HJFalY=; fh=TQATEbdDZNcnk8L2eDP6eFL9HlexFaHIexhR1TH2IlY=; b=g46CLbYfIsucWcsOnmwCf1904wOUhCrJuAhjMa64uVTlYX9H8MFeyVDPnQc7ZK2ZJ0 J63XeI8KpKuWOybb94If3E+7N916eyNp9QAA1iOgeQ0BQFjoIGpCIUsmz4v6FJntkNU5 lsQ2C3vlg62dijdn7CDnYXlO1cZvK9vtHViTPsdrQqqHl09vQsYAsJ+rHo5mtPUAQvVu H5HZ9//bMByBuYfcSA4DqmrRKsG5sGildL4UkDtpg0vb9Sv2onP3sD/6JnA2sFcuO1O9 KWFKFMgbzF3wF8uZl6va2IN+AFDeFt9+H7MH/fm301dsvaTY54p/xow3U/hvGb1bDs+4 RVPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=cWyIHDq1; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-213571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213571-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5a19c80si17237456d6.97.2024.06.13.08.43.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 08:43:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=cWyIHDq1; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-213571-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213571-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5D5031C244E2 for ; Thu, 13 Jun 2024 15:43:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BAB79155CA7; Thu, 13 Jun 2024 15:40:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="cWyIHDq1" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 A73FD149DF8; Thu, 13 Jun 2024 15:40:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718293214; cv=none; b=Gf5ALALpI/+pKHFlPJAyEORTnj4r60n2U85HKvi/NgpwipJbdm6aUk4gJYL08HleiqrWN+pJTYIKJlVUF/XbJ8K8XEq7Y7i0bvsbMjkYxt/TYEdsOa2Qx86QyKtA5Ax9bf7FZ98RsYVQ09GJAgtO4jPJ4UeCUyU0p1JRKUwC/Js= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718293214; c=relaxed/simple; bh=BnBKZ4SLgyTRDGc+4mcuALdwdNeHn4yqirCw7lO0gO0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SDSCcHNVGKTsx68GLGAUERcSHGbbplUDSiZnftDBuJ9GZ6EDRMnN8G+h9r7jkz8vx5ApofwKpo76WUi9jv7CnuOKNZc7kI21ADOh4sHRUkjFemcmJy/P+33WxSgj8a6JxFSUiewQTrWQ2Fn6pnFhysdXl2l0Czh6mTjTSEA2wEY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=cWyIHDq1; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45DFRdFr006553; Thu, 13 Jun 2024 15:39:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=fhyNLk4BgDYNJ AsfSc8ftWCxz9OlL/4RiKPE6HJFalY=; b=cWyIHDq1RAItpr8T2Zral2xZSc0zm jtsseHWF19RO2x3PrSFtVLi8ZXut+8Dmv3tmY20C8zxzLD+JML9M9wLW2vxdbEsa 50u3Lc7QsgF0q4fMEos0LVe8HD1Ib0l+tc5VPBRPrRx+yTu2XbNpbssvbSksB2Ei 6KlylZq3vo1AcWAlcRtK429x8SS3ue+WWXN+ZRKReTxP0iYS27kJymM6d2F/nquD yOMiy+y8vyEnh+jxqbxM+/2rbS7GzfrdGgo8dNsy9LAIqNO2vqQ3VWY4k4/QGA9P 5XEniWJ85wtYe/bLQZIAPuXhCJes6aI/FD6qqgYy7J6YTSPkltobxKhMw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrext122-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:48 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45DFbRBs026015; Thu, 13 Jun 2024 15:39:47 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqrext11v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:47 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45DF1n5T003878; Thu, 13 Jun 2024 15:39:46 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yn2mq9174-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jun 2024 15:39:46 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45DFdegR28836448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Jun 2024 15:39:42 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0DD092006A; Thu, 13 Jun 2024 15:39:40 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F70720065; Thu, 13 Jun 2024 15:39:39 +0000 (GMT) Received: from black.boeblingen.de.ibm.com (unknown [9.155.200.166]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 13 Jun 2024 15:39:39 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Gordeev , Alexander Potapenko , Andrew Morton , Christoph Lameter , David Rientjes , Heiko Carstens , Joonsoo Kim , Marco Elver , Masami Hiramatsu , Pekka Enberg , Steven Rostedt , Vasily Gorbik , Vlastimil Babka Cc: Christian Borntraeger , Dmitry Vyukov , Hyeonggon Yoo <42.hyeyoo@gmail.com>, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Mark Rutland , Roman Gushchin , Sven Schnelle , Ilya Leoshkevich Subject: [PATCH v4 13/35] kmsan: Use ALIGN_DOWN() in kmsan_get_metadata() Date: Thu, 13 Jun 2024 17:34:15 +0200 Message-ID: <20240613153924.961511-14-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240613153924.961511-1-iii@linux.ibm.com> References: <20240613153924.961511-1-iii@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VR4XIXc8lKCWS8yjNDEOiQ51qu6t9VNR X-Proofpoint-ORIG-GUID: k0noGJyAWC71kZXWZHDEVVjEwOhT6Aub X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-13_09,2024-06-13_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406130112 Improve the readability by replacing the custom aligning logic with ALIGN_DOWN(). Unlike other places where a similar sequence is used, there is no size parameter that needs to be adjusted, so the standard macro fits. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/shadow.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/kmsan/shadow.c b/mm/kmsan/shadow.c index 2d57408c78ae..9c58f081d84f 100644 --- a/mm/kmsan/shadow.c +++ b/mm/kmsan/shadow.c @@ -123,14 +123,12 @@ struct shadow_origin_ptr kmsan_get_shadow_origin_ptr(void *address, u64 size, */ void *kmsan_get_metadata(void *address, bool is_origin) { - u64 addr = (u64)address, pad, off; + u64 addr = (u64)address, off; struct page *page; void *ret; - if (is_origin && !IS_ALIGNED(addr, KMSAN_ORIGIN_SIZE)) { - pad = addr % KMSAN_ORIGIN_SIZE; - addr -= pad; - } + if (is_origin) + addr = ALIGN_DOWN(addr, KMSAN_ORIGIN_SIZE); address = (void *)addr; if (kmsan_internal_is_vmalloc_addr(address) || kmsan_internal_is_module_addr(address)) -- 2.45.1