From patchwork Fri Oct 18 09:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pintu Kumar X-Patchwork-Id: 13841465 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 0C375D2127B for ; Fri, 18 Oct 2024 09:22:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D936E6B0096; Fri, 18 Oct 2024 05:22:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D43E16B0098; Fri, 18 Oct 2024 05:22:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C0AA46B009A; Fri, 18 Oct 2024 05:22:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9E79E6B0096 for ; Fri, 18 Oct 2024 05:22:47 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 08D8A81691 for ; Fri, 18 Oct 2024 09:22:37 +0000 (UTC) X-FDA: 82686183048.28.6243BDB Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by imf27.hostedemail.com (Postfix) with ESMTP id 344C940002 for ; Fri, 18 Oct 2024 09:22:34 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b="eU pY00o"; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf27.hostedemail.com: domain of quic_pintu@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_pintu@quicinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729243246; a=rsa-sha256; cv=none; b=Vie6+/CwCh1e3F4VyL4MJdjnZmYNg3xwW6ATQHEyBUN6t2gkralmGbelzZw3SyZY2EkN+m e1ybStEIpTFXCXF3VKhA0GwS3QPpKSZRkAGoSYAaMVOg0qSpnomu12na7nGslEqvTgAi8O 2RZwBGoQU9778ZJMX9w3W9GGNVRCy1I= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=quicinc.com header.s=qcppdkim1 header.b="eU pY00o"; dmarc=pass (policy=none) header.from=quicinc.com; spf=pass (imf27.hostedemail.com: domain of quic_pintu@quicinc.com designates 205.220.168.131 as permitted sender) smtp.mailfrom=quic_pintu@quicinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729243246; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=ypNyheCLO8fd3m2liOpgl6CzILJlaANSUDyAIrNWJGk=; b=xJa1UIAvks/vE+/8EIYA6hO428Yei9lnv5y15JHiUFgz0XVMcyE+IrY3EKUwMa/5V73FtP 5OSagpSdK0BIqXgax6RlOEaFT7O3fHaOWSHx3kf5KSDlXFEVgdlnSFtqVO1zuwF+MB4sBZ 8xMjMATqqE1oV93hvxMsq+mRpZPXAHc= Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49I1gJNQ021882; Fri, 18 Oct 2024 09:22:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-type:date:from:message-id:mime-version:subject:to; s= qcppdkim1; bh=ypNyheCLO8fd3m2liOpgl6CzILJlaANSUDyAIrNWJGk=; b=eU pY00opyDQBGs7Z53W8+u9GCM5DmT1YZgw8RYPMw2khROEbUEDTMm2KZcwqwlABy+ k9mIcDrIbk7HQWGS9J2eHXyfjNmGmKQd7+nhptAJmbSTiXUk2g2kTDBVC9JcSsoQ Mz6Gf5Cuxxps/Kz9aBFgX/rNH0JHuIegy0/WRCZyKl3zCcoyH4ZHfI8sC04nKahN WuzvV7iNY2dqV5PvWy0yOiEGOiRmJmjp01mVQmInGtBIULikwLrhtQqRW0tVwJ2m ENO+9QTALIm7i3s2/qV1myRZZMENU+D/5xfIglngirwEVOmzuJaRxInAnzf0Hzrs ga7jN/vWrXG1fIJu6gUw== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42be8c95a6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Oct 2024 09:22:38 +0000 (GMT) Received: from nasanex01a.na.qualcomm.com (nasanex01a.na.qualcomm.com [10.52.223.231]) by NASANPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 49I9McZs022578 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Oct 2024 09:22:38 GMT Received: from hu-pintu-blr.qualcomm.com (10.80.80.8) by nasanex01a.na.qualcomm.com (10.52.223.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Fri, 18 Oct 2024 02:22:35 -0700 From: Pintu Kumar To: , , , CC: , , Pintu Kumar Subject: [PATCH v2] mm/kmemleak: fix errors/warnings for coding style Date: Fri, 18 Oct 2024 14:52:05 +0530 Message-ID: <20241018092205.757-1-quic_pintu@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01a.na.qualcomm.com (10.52.223.231) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: g-bbuv_bw_i_Lr7gbY3p1wkwxmEYHZIG X-Proofpoint-ORIG-GUID: g-bbuv_bw_i_Lr7gbY3p1wkwxmEYHZIG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410180059 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 344C940002 X-Stat-Signature: 8e96njt3zdxrp3eaukxd3uo1fayrcnn6 X-Rspam-User: X-HE-Tag: 1729243354-851466 X-HE-Meta: U2FsdGVkX18LC1vxpx+2+vkioui/udmGJgizpS1epPkepYK0g0MAnIKH87KmWRZf2nrr06yZvS3+WrHbsVz5O+Z3yY1MSxUo8SHkHTJW0pJXpmRHpYuKCtiaT5rI1GmlxQgWvfD9hp2nBKJuRCMlZprKoVSiuNSOTsWz1D2G7mAb3X7cvWIwepH92loBxGPclN+QJWhRmpLRHOPhqPy/WdK1v5mKsJzFfZtPWzQEUJf6QdQg4MYjt8WeXB+Hhde4betlaGl6YsW/qvhQCwzW/ZAUonWttrfEgNzVXsDgH+Dk1ow3UGBmBHCb41Q6F1GXWRViV4Dci/x3baSJzBDBUb3ToMWUMsu+PQ4r1l4cfc1fwfUVM2m3/l3BdfVPl5CLgh2p0W/ELl6/Se0yguXUc72HSsySheoclqazmxvJ44EqLd5fxI49gIaAPAS/Rqa8qRdT0FEyEhzbGKPms2GQl4cpeuvtoi+AuFB9ZBPjnoOpjkty+rlhQygbbwWwjp2B/hUvio5CDyt8fRRyk8NqB/zUKuzxOezGa95nthPqyAo5FuRlWxypx4IhdsnWmLTTrcoktnfCNpgKd5g+3gpdbtLKbF2HnpP5PWnMufQoz4xvC9wWTksCLMM4Pe/3Q5r9kwaOkHrM1/06oWDVyLG2hkiSrTA0i0XZsbUEbMR3HJ99s0vW1FPSnPZYtcH+hJRkD/mibJQzTBiRNWMxelX83V20s5AU1NchLliPkbYxIixClyrkyBguCZsgAb+f4XNIG87TC03GzkDrsbFqqWeNkR/OG2jQjUyGuWj0xqUrV4Un2yb33hTLbkE4j/guX+Axo6luP7xv3yHmbYQFwEUid6OO1gnQ4StOfIqYsCy5eNk6JULyt4k6BQSeZc4eWerzYzVU1Tan2BAhOdOuoERUwXN00V6tMUkk+rkJ3pUxn1+CAjG+Mry7qnQbkKV7oxoMjOVOd2EaXgWb4fbF3Nb D4urk/dL u0BYkP0Eb70Pjk4IBVoHMtUxq578NvTjmWUs7+HXkc43UEqSfOgEYUMc+ogbJVe0cQl9OQ1v8wnE6mpsA5W8/uL6p1Y4mYCOtLw5y2/JEpTZ+8lofTQ/tgjz0IUmISlhJ+eOf37I7aRDO2uJO9IOCzqheH1V2UU1hjfxtzKi2RpDE6n15zN7b9AAzHFkyGabqv8z5R6Qj/dqhG0xR4nlLlzU2AFlQsBU7Gpcd+jWZt6Z0GNLfNIGY2sCazzowcoV3NrPjYNL3wtoFuCFGzWDZ/fNl5t31bByKxQUfPEoLoPNioVFuTcRWt/zQlD5p9xkRVEfjCASzFYWUKx9gf1aICHnWhRf9Uf1XiXvtAbIw4Tfzia7PsLCjyKUpZ3GarkiRQjD8Xm9LomDJcXxpEkxrWJufF4jpT19AokDNDP1Lwb6SH/C0wfyzPnVX7Q== 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: There are several errors/warnings reported by checkpatch. Fix all of the positive once as below: - Use #include instead of - Missing a blank lines after declarations - Prefer 'unsigned int' to bare use of 'unsigned' - else should follow close brace '}' Signed-off-by: Pintu Kumar --- Changes in V2: Introduce missing bracket in else as suggested by Catalin Marinas. V1: https://lore.kernel.org/all/ZxDbgS98-_VNkGXJ@arm.com/ --- mm/kmemleak.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 17006d8a2afa..312a1a9fba97 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * mm/kmemleak.c - * * Copyright (C) 2008 ARM Limited * Written by Catalin Marinas * @@ -95,7 +93,7 @@ #include #include -#include +#include #include #include @@ -373,6 +371,7 @@ static void print_unreferenced(struct seq_file *seq, for (i = 0; i < nr_entries; i++) { void *ptr = (void *)entries[i]; + warn_or_seq_printf(seq, " [<%pK>] %pS\n", ptr, ptr); } } @@ -1711,6 +1710,7 @@ static void kmemleak_scan(void) rcu_read_lock(); for_each_process_thread(g, p) { void *stack = try_get_task_stack(p); + if (stack) { scan_block(stack, stack + THREAD_SIZE, NULL); put_task_stack(p); @@ -1817,6 +1817,7 @@ static int kmemleak_scan_thread(void *arg) */ if (first_run) { signed long timeout = msecs_to_jiffies(SECS_FIRST_SCAN * 1000); + first_run = 0; while (timeout && !kthread_should_stop()) timeout = schedule_timeout_interruptible(timeout); @@ -2062,7 +2063,7 @@ static ssize_t kmemleak_write(struct file *file, const char __user *user_buf, else if (strncmp(buf, "scan=off", 8) == 0) stop_scan_thread(); else if (strncmp(buf, "scan=", 5) == 0) { - unsigned secs; + unsigned int secs; unsigned long msecs; ret = kstrtouint(buf + 5, 0, &secs); @@ -2179,9 +2180,10 @@ static int __init kmemleak_boot_config(char *str) else if (strcmp(str, "on") == 0) { kmemleak_skip_disable = 1; stack_depot_request_early_init(); - } - else + } else { return -EINVAL; + } + return 0; } early_param("kmemleak", kmemleak_boot_config);