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(); }