From patchwork Thu Jun 27 14:57:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13714623 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB781C2BD09 for ; Thu, 27 Jun 2024 15:14:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47EDD6B008C; Thu, 27 Jun 2024 11:14:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E0326B0092; Thu, 27 Jun 2024 11:14:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 236106B0095; Thu, 27 Jun 2024 11:14:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EE3076B008C for ; Thu, 27 Jun 2024 11:14:45 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8E97F1409A4 for ; Thu, 27 Jun 2024 15:14:45 +0000 (UTC) X-FDA: 82277015730.22.AF7088C Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf15.hostedemail.com (Postfix) with ESMTP id 4653DA0017 for ; Thu, 27 Jun 2024 15:14:43 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Y5PFjIf5; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf15.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719501270; a=rsa-sha256; cv=none; b=nSAIbIm46SROgBAfJq73GOkKF+PTqc05pmqEyHw72DGInbAGaDO1VD6hQLHjgsF6tOvSt7 NoDu1S6lHs9uo0ZMORfQBEIoa39KZLKrLHi1GiasDiC8eRk68PKa4T5bkWxBdMm8Scl1kg FENuB17ZKXj6jY2TMt4R7vyBg5kHWl8= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=Y5PFjIf5; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf15.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719501270; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9nSO8vQ8LysldJ41kUs8BTYUja1+gnKPMCjMQs//hno=; b=5CBPNwdPK3HAyT/EniN4j2+RLnWiP5zBHU5+lOPThoewdm11Cqdk2jRgJXtycc1G6S0Ak4 CnA9OuAUdd2VgydT89rR68ggmLnSYFLAvMZ3sERj2NiN2yFT4sEvXEMFmVwP5DePgcbylQ uoBqftzkCmU3bEOk9T1mCPLPcWjctws= Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45REuqR1015553; Thu, 27 Jun 2024 15:14:40 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 :content-transfer-encoding:mime-version; s=pp1; bh=9nSO8vQ8Lysld J41kUs8BTYUja1+gnKPMCjMQs//hno=; b=Y5PFjIf5h6Km09SvAKoQtbFtJtQL9 UxKCaUYxKjp/3iayxbso7EzUhUx8yCP/6mkTpD9JErYqUUTM7DCapno8yKjRq6Vl nR9gbuxNUdtGaZ0jdS03iXe8ZEsM2YkM79rd8wE2Z60xBPSaAHNTLl5sRYnGNav4 0N0G1+4wPckEWUF9eEENeUs8nrNpLvIsJ7BLmRZkRRU3qhOsq4M9o/0mIYl1g5dH H3RNUky0n5Xag5d1FtFkfjuq4iChNuBt3qz6mCQ/gFdBYTp6hJwa8Zo2H5YT2jfp QHABQ7AYb07we3mZdwPtAr65nukhNzN2lCIhucxyU/O30YB4Z0b/FUuaA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4015fsrryj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 15:14:40 +0000 (GMT) Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45RFEdCP008846; Thu, 27 Jun 2024 15:14:39 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 4015fsrryd-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 15:14:39 +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 45RBjA4l019602; Thu, 27 Jun 2024 14:58:02 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yx9xqba9g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 14:58:02 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45REvwtr20054466 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jun 2024 14:58:00 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A80522004B; Thu, 27 Jun 2024 14:57:58 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2346220043; Thu, 27 Jun 2024 14:57:58 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.182]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 27 Jun 2024 14:57:58 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Potapenko , Marco Elver , Dmitry Vyukov , Andrew Morton Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ilya Leoshkevich , kernel test robot Subject: [PATCH 1/2] kmsan: add missing __user tags Date: Thu, 27 Jun 2024 16:57:46 +0200 Message-ID: <20240627145754.27333-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627145754.27333-1-iii@linux.ibm.com> References: <20240627145754.27333-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: -d7cZN-z68hAjVNQeXA7A1nEUn9qEmjC X-Proofpoint-GUID: tjwTrgx4dkgHL1UYAClt-09Hv4Ljjbml X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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-27_11,2024-06-27_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=988 spamscore=0 adultscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406270113 X-Rspamd-Queue-Id: 4653DA0017 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 1u8yxihh3z6nxpbahd9u7sq9jrtjq9cf X-HE-Tag: 1719501283-573415 X-HE-Meta: U2FsdGVkX19MLGgY2wjYHbXkUcfNKTivo+ihRaWc2IXvjfSxgWF5QRIoc0T3cXzd+vocI39x0agTYfRegz9uh9RIwP/sN80ijgvjH6SkGOChd5+qbSUye4XX21iBUu76/2QKrbbkjO9dwc0CgM9d7+HucwFtr+0qJg9zzPxDlByrKbYWytF4RWrVfoSXz4wlDhAtgQ9j0JFR6PJERQPfQDtsRRzqm6y1vg64f8zCx9P8YUEpgCR+t8+DbKPdeGSRJcmFAElfdG6P38feY88PvGTEme+TcVI5syT8MrOYuZNXUup0wgFjraHlFCuFM8R0HtrMrquzlox2KkzOtwQxVHyyQoSyb2zNkmAH6egH4sDkFhqrkVBs9QKIz3TP1wCanA0TMlG1H0pxCqogmGXjNVFNSi9SWF5joQvbmMtcrZPutQqTHxvondUH1V2hCT56WzOrMcBUWrt4lqxcbwgz5NdAylatmRH/pFc/M/aW4NBdg8WuyUthRNBgh/hyggzh86N1Y903h/giTHYVofdko5fJpxCmbDI3hMG/c/gRmLyVtzj5rHPCrIEPwLJAgmLcqEGVimQn7iOuP/8wc76T+UfgYzecoBko9Hav29dMxBZ4R8y47YIgjyrTnppgi/yWp+x1m246LTz6aFMrONyDk7l5CNtCiOUovqYy9DsRcXIptmlLmZSS6c2WzTLd3AWe8H1Sc8xBMruIqR28Zfz7RJXYoaagkEA4wUus1DFWZ4sqmJyEdjl+/7mtFxvvaLRCAn0cRsoB13FoQcGIhR3OOITZqWV+trE3zjF3J9jfHjvm2vUBFUhBF2MHC5cltHDA5wPXa+L0X2IdOQD41czXXfFdNaovU1mbxD7WI06HDRfgKzlP8xo0ZXaebLiv8loZr5qMCODbO7H3rzOPSKKQ9NAuPvbhpuKqv2DJLb4c7jYvIXTIENpZeu5rCfH2n7liH/W/NreA0+iFdOsxOZv 1GBo4h/I 9fCVqWKualpZW+PzkEzRi64+8YlEEui1pB5Kmr0pdrNEt+SRX9SdBu80hbRTqBQw89R/xHLOctgks+tGriHfQR+HvF2vWA628IzAD0SfRdo1btUYApLEkgXYllsym/kMijJw/72nt9Lwb14yhiE3QpWFt1j9Yca0kK2jUGh90/yaSX52/KAr474XGl+hoJhP8oT/w0Y4xEG1CyZjB1nq0VpUWX1BUpiakPZu6sibOwuwR7OOCdxohVoEsgyS2Fro71CLAQ7Y8SCUEKmrlAbDUpPdcA1iGOGKz9MOQc5L5viQfZDagcCZbsUXumQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: sparse complains that __user pointers are being passed to functions that expect non-__user ones. In all cases, these functions are in fact working with user pointers, only the tag is missing. Add it. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202406272033.KejtfLkw-lkp@intel.com/ Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- mm/kmsan/core.c | 4 ++-- mm/kmsan/kmsan.h | 6 +++--- mm/kmsan/report.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/kmsan/core.c b/mm/kmsan/core.c index 81b22220711a..a495debf1436 100644 --- a/mm/kmsan/core.c +++ b/mm/kmsan/core.c @@ -249,8 +249,8 @@ struct page *kmsan_vmalloc_to_page_or_null(void *vaddr) return NULL; } -void kmsan_internal_check_memory(void *addr, size_t size, const void *user_addr, - int reason) +void kmsan_internal_check_memory(void *addr, size_t size, + const void __user *user_addr, int reason) { depot_stack_handle_t cur_origin = 0, new_origin = 0; unsigned long addr64 = (unsigned long)addr; diff --git a/mm/kmsan/kmsan.h b/mm/kmsan/kmsan.h index 91a360a31e85..29555a8bc315 100644 --- a/mm/kmsan/kmsan.h +++ b/mm/kmsan/kmsan.h @@ -73,7 +73,7 @@ void kmsan_print_origin(depot_stack_handle_t origin); * @off_last corresponding to different @origin values. */ void kmsan_report(depot_stack_handle_t origin, void *address, int size, - int off_first, int off_last, const void *user_addr, + int off_first, int off_last, const void __user *user_addr, enum kmsan_bug_reason reason); DECLARE_PER_CPU(struct kmsan_ctx, kmsan_percpu_ctx); @@ -163,8 +163,8 @@ depot_stack_handle_t kmsan_internal_chain_origin(depot_stack_handle_t id); void kmsan_internal_task_create(struct task_struct *task); bool kmsan_metadata_is_contiguous(void *addr, size_t size); -void kmsan_internal_check_memory(void *addr, size_t size, const void *user_addr, - int reason); +void kmsan_internal_check_memory(void *addr, size_t size, + const void __user *user_addr, int reason); struct page *kmsan_vmalloc_to_page_or_null(void *vaddr); void kmsan_setup_meta(struct page *page, struct page *shadow, diff --git a/mm/kmsan/report.c b/mm/kmsan/report.c index 92e73ec61435..94a3303fb65e 100644 --- a/mm/kmsan/report.c +++ b/mm/kmsan/report.c @@ -148,7 +148,7 @@ void kmsan_print_origin(depot_stack_handle_t origin) } void kmsan_report(depot_stack_handle_t origin, void *address, int size, - int off_first, int off_last, const void *user_addr, + int off_first, int off_last, const void __user *user_addr, enum kmsan_bug_reason reason) { unsigned long stack_entries[KMSAN_STACK_DEPTH]; From patchwork Thu Jun 27 14:57:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13714624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5619FC30653 for ; Thu, 27 Jun 2024 15:14:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8EE876B0092; Thu, 27 Jun 2024 11:14:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 852106B0095; Thu, 27 Jun 2024 11:14:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 604916B0096; Thu, 27 Jun 2024 11:14:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 3940D6B0092 for ; Thu, 27 Jun 2024 11:14:47 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9788D1206E3 for ; Thu, 27 Jun 2024 15:14:46 +0000 (UTC) X-FDA: 82277015772.04.4CCA3FF Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf07.hostedemail.com (Postfix) with ESMTP id 4EE264001D for ; Thu, 27 Jun 2024 15:14:44 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=HYol0NrL; spf=pass (imf07.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719501267; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=V66HzH9oSR/SiSXR4ViDL5nQK43Lz5hHmVXw8cMBNuw=; b=r/OfPvJQRwjP9niYatZTk1JUTDZm+IU6/s7EHpPQrCgsV6SYlyuG8pwhtm06C8iM5Kfjwn yJPIZONjYz/Tuxce3rwELPpCBbjEAIiAryCMogb46FoswCsG/tvw/kY3jV98H7BiieqGyW b4yckAaC4HMlEfiKlPAYP3kiqDS0XqU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719501267; a=rsa-sha256; cv=none; b=rHXpPH+NbaRsXNjRB2Wkd5fyqZV29J90M4DDUoVj22vtN8mO/mDeoSOxKb1tyAkAacRPX7 eYXRD6hjaXLbv+iifGJd38/FJqQVjx5qvSuBuy7CNZAD0qLRwAgGpDZVcmbk7OKvd3p4vu ax5WOBGngY/FvOv1/BC9rRIgmiu6sb4= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=HYol0NrL; spf=pass (imf07.hostedemail.com: domain of iii@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=iii@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45RExQfU013827; Thu, 27 Jun 2024 15:14:41 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 :content-transfer-encoding:mime-version; s=pp1; bh=V66HzH9oSR/Si SXR4ViDL5nQK43Lz5hHmVXw8cMBNuw=; b=HYol0NrLDGcv8wIfLxnjT5kNzFtU8 6ijvy00JM8Ynf2cqI01FLnIyAD79Tukg+x/nIxesnHpXF+ZEqKX4XLA1gF+D21Ch O0Ovk1gTYLx9XRZH5oMGk/sEUnxeKshqZqzIg7c1VO7K9RJkPYqo4uMUwNAXJALQ vzx3AVJTeQChub8JBBeUdfONGwnyvmXKFyb2n8nAXWfqDSeP59WMmEYEcF6W3219 cluGfFuEUYJHKqJgKsVDUz8JyCjDwqOhjsouG5aTrGwOSLsNoeyaEaVzmn8CaN3w Vk98bCjyjN83n6V84GD53sO9QZpxRSDzi5vTgJe8ZfRfIi8751b+mxOhA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 401aagr19w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 15:14:41 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45RFEffv005834; Thu, 27 Jun 2024 15:14:41 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 401aagr19m-10 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 15:14:41 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45REWkbs008183; Thu, 27 Jun 2024 14:58:03 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yx9b13fea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 14:58:03 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45REw0Ot54133066 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jun 2024 14:58:02 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E340E2004E; Thu, 27 Jun 2024 14:57:59 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F12420043; Thu, 27 Jun 2024 14:57:59 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.182]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 27 Jun 2024 14:57:59 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Potapenko , Marco Elver , Dmitry Vyukov , Andrew Morton Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ilya Leoshkevich , kernel test robot Subject: [PATCH 2/2] kmsan: do not pass NULL pointers as 0 Date: Thu, 27 Jun 2024 16:57:47 +0200 Message-ID: <20240627145754.27333-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627145754.27333-1-iii@linux.ibm.com> References: <20240627145754.27333-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: mcPDNdB_CcP6JYr2AQf9iTbwGMyHfuTJ X-Proofpoint-GUID: db94Zo-DaWkLUU5XH6LyXhk3sy8TGMD3 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 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-27_11,2024-06-27_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=968 spamscore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 adultscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406270113 X-Stat-Signature: yq33me3zb73ackhaj85wakw9znacaenz X-Rspamd-Queue-Id: 4EE264001D X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1719501284-718540 X-HE-Meta: U2FsdGVkX19bpDCsokng5ACi4KlLvQejEChSTFkP2kBgupYc3CrNbL8FKBVLZTkoqQD2yD5op9X4F5ORy7GQqWjww7FlbHBWCI7ANEphEhR8JH8iAxe5gbUrRe9ePpSV6xcul461X1j8CC75bOKwXoPGhvcx31fSo2RwTiBbaFoLF/qrcLoHVVnkrN4sGM1E/qKuMnDFSinQbFKacp8vgEtM8mXllQNctJg+ha8wk97d43yiIDhXZMgj9JL2pQTcLiXKGL7quUBG1fZTHJBFEcaMcNpKDA18KOHyKRTzyoklmtIRyiJNncahLbNrcS+s6QvXHCURDjZnFq3PCN3KSCj5Cq9h28PCJZ3eVxmT/3pn4jgd6yd2exj6eIR7wacaOjsKTLcIk0XnRYiT89TuEk0C5dv2+zQSE+2+KQZ/KKShfJBJIGJViqC0hSFqMajjmG7FnNApmbuMtlFna8JxByFplRfc/Ge3ikB31xZASD9T8RXwlkYkjv4VKlt5sZ56K9A4xbod7Q9FdJWQMURISZSVbHcoE+5Nv1roT6tuhpIursxsB2DUTNJ2eSGeUCAJ5++kTtzwE5cQOlNkUDltoqUbdcOnNzgTB/emaBulSlTsIU+Gjub1oSyaHVGE3j7kAWkEMpTxt4Up37Fh6JuBCWV7/dD/nCUmRAVKD6XasYRTskHd5LUyCWjdjgTlWpKEFNgPVnSbiPAqMziHmHEZHi52kL1Ysy6IRnCNPJuXCcVMOU2fI+Gzsws/GBdbzgbxUIHAvRv709htxgq6uQVlPPC2SdhGjH3tJTP+PM53J1hhaQ8CEzIkO7IeJCYJ0woP8jlMr73NqBzS8s6eYcxSQ2Ixr9xm+mh86+YwZFY0L0WuQRIM5ZGNBJs0HY4WZGydbo/8sfNb5I0HYDsJfOINbvFmhZZkeD9AaRHDJ2HCUGB9J628EUcfMTGY4vQNYGqzxuPm9UVGyIBj/Ozpsus Qe/W1u8b B3J+Pela/8NXpoVnoopyZBBttiKLFpSqrFcYq4dByZFzhvB5FinrjB8cjhqO5m2yLpBD/0rMH6ywSn1yZ8NNrkDXbNqZ6ycQbTat8srpijqYMxJlxDyleu0SDX91z5u4DdtdZxgJVE1DOrYr0FmRAG6D+14TBHDOOW8kjP3kYAbbzH9nCvkqR7JGnIaQc5eZeWPx4COggv/dJJ7v9SnRO56MCE6NKrJwTzeCodQtw7fahG0Oezc4CEDdwPvPMm5tRSiOP X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: sparse complains about passing NULL pointers as 0. Fix all instances. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202406272033.KejtfLkw-lkp@intel.com/ Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- mm/kmsan/hooks.c | 15 ++++++++------- mm/kmsan/instrumentation.c | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index 26d86dfdc819..3ea50f09311f 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -303,7 +303,8 @@ void kmsan_handle_urb(const struct urb *urb, bool is_out) if (is_out) kmsan_internal_check_memory(urb->transfer_buffer, urb->transfer_buffer_length, - /*user_addr*/ 0, REASON_SUBMIT_URB); + /*user_addr*/ NULL, + REASON_SUBMIT_URB); else kmsan_internal_unpoison_memory(urb->transfer_buffer, urb->transfer_buffer_length, @@ -316,14 +317,14 @@ static void kmsan_handle_dma_page(const void *addr, size_t size, { switch (dir) { case DMA_BIDIRECTIONAL: - kmsan_internal_check_memory((void *)addr, size, /*user_addr*/ 0, - REASON_ANY); + kmsan_internal_check_memory((void *)addr, size, + /*user_addr*/ NULL, REASON_ANY); kmsan_internal_unpoison_memory((void *)addr, size, /*checked*/ false); break; case DMA_TO_DEVICE: - kmsan_internal_check_memory((void *)addr, size, /*user_addr*/ 0, - REASON_ANY); + kmsan_internal_check_memory((void *)addr, size, + /*user_addr*/ NULL, REASON_ANY); break; case DMA_FROM_DEVICE: kmsan_internal_unpoison_memory((void *)addr, size, @@ -418,8 +419,8 @@ void kmsan_check_memory(const void *addr, size_t size) { if (!kmsan_enabled) return; - return kmsan_internal_check_memory((void *)addr, size, /*user_addr*/ 0, - REASON_ANY); + return kmsan_internal_check_memory((void *)addr, size, + /*user_addr*/ NULL, REASON_ANY); } EXPORT_SYMBOL(kmsan_check_memory); diff --git a/mm/kmsan/instrumentation.c b/mm/kmsan/instrumentation.c index 94b49fac9d8b..02a405e55d6c 100644 --- a/mm/kmsan/instrumentation.c +++ b/mm/kmsan/instrumentation.c @@ -315,8 +315,8 @@ void __msan_warning(u32 origin) if (!kmsan_enabled || kmsan_in_runtime()) return; kmsan_enter_runtime(); - kmsan_report(origin, /*address*/ 0, /*size*/ 0, - /*off_first*/ 0, /*off_last*/ 0, /*user_addr*/ 0, + kmsan_report(origin, /*address*/ NULL, /*size*/ 0, + /*off_first*/ 0, /*off_last*/ 0, /*user_addr*/ NULL, REASON_ANY); kmsan_leave_runtime(); }