From nobody Thu Sep 24 12:09:13 2026 Received: from mail-wm2-f12.google.com (mail-wm2-f12.google.com [74.125.225.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CD5F396D03 for ; Thu, 24 Sep 2026 09:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790240738; cv=none; b=KMfgwnXJQ3vWP9l2C9CGAkTvLomWnCAAM/B3VoEtkJPIQLMHRtc5z9FLMr03fANUMV8MM939YUCOnFAVzV5FAM4KtSINEf9eJMBjUpI95vNcFYPdzLvnINO5wQyl873EtmL3tyk08e0fOsP2k7gy2EuyBQGSaJ5Qz5HQhpjjnbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790240738; c=relaxed/simple; bh=gneipLsgqKEAyVQAZll6RiNG8vO7ec73+30d+3Gw2Nc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YaIlahy5Q3OL8OsPywuVJHEoK+YCKX4S9GjQQ8xdd5ziGUVdCkpNI/9QrJHOn4JF0g8O7rwBEqQz2yJ3nxzhdBpGIxs1JSM8KHrK+GGdcqXoVq48XGljN8iLiaxYznTKfCJj6zPoxaSieDuUIOU9JWudnIOloUPRRGNrPCwujx0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FYpqsvWo; arc=none smtp.client-ip=74.125.225.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FYpqsvWo" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49cd4ba9f68so20438845e9.1 for ; Thu, 24 Sep 2026 02:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790240734; x=1790845534; 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:content-type; bh=ppC8TRBPEanEndEB0ZLxZ/g+4/pJXzez/E6F6ayShus=; b=FYpqsvWoijJm2RUXLVNt1YhKhj3xaPMGf70DiciPjlN+u2x3zZX/RREQkKCQuXojOw BSTqC9giJKQLrIJgbjqFXd7M45XcbhC4KKP6irjvWLeALiZymNx/rM7/PplYT7vx0YXd px3y2um1oYnaH2a5sFDMOKFpn9vPtiDFFFlVOkPi+4+kxNNrinn+rF33YMqJ5vdMoh+q fZxSDN34iPokwYVZIEX9AAjArAGLWTWhFdc/ducFIsGapMZN2+5jBnX1Abrqstu5a7B/ HpGEt6xuuUgXFzwkSZpXPxrDOwpPOC2khNK5XGe7K6kpLaTOsHQb++fU0mTyrLBOEz/s /b8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790240734; x=1790845534; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ppC8TRBPEanEndEB0ZLxZ/g+4/pJXzez/E6F6ayShus=; b=NUF5/CH1XBzWupfn338Gu+xgdYpq/H7F7m5mJPtpDg/4lkeKqLOhCjFXHdjLSJBSz7 APw/rTDbl9YuuPAPXSVyXmOrPeWUE8qrIHkeqL8O7wxSxHfPggNYjEAY1/x8cIiW86f3 MUMo/teixBBzMQR9PKAc11bAZoOM+C6wRxeurzmzW9ah19pc6EuT2InAY8AHlEMiLn9u hZ/8I5OJiU+zHMkTlZG+7f/VPyq50si29zjLs+PQ+QNujfBuWJBK0FlvjtV8mONUs12U p+qUB8rGu9tdmgZEaOYLbFm+VRQ+fpcV9r2zM/EoUJVomdvPRhO51LD1xY99UnI6cycA u0Qg== X-Forwarded-Encrypted: i=1; AKwUvBwoCZlIX6ukxJdP27M9dOHxrmhiAbiFSiHiRN8sbxAhNUyiET2j14mKKKLZC5Od32n3kZRx8bebIczO4NA=@vger.kernel.org X-Gm-Message-State: AFuF++mQ+SN0VRnD6EsJILjmLFUV/pqnC/a+wF/0KIGx/MHkmahbYRkG /zFBoTGPBpAHnDwatq1gVknnTGv6TMk/cttpzw3VXUmvXa7sDGMOj7ie X-Gm-Gg: AYBFou18KIH9cDdQQckkESZOIxRQwGTnwTJAvNHBLpJ71Rdw4DD8qTW7upMkjb7ADEX xggKbuKVaLsax79TZg8LGkVaXaygJlcTKWeNKyFHbjv5Yy4a7FQC0E8/A9mHNuuSSZolIrWS9pi 1Rg0yn1zdVxVUhqhX/W00t33t8P6WpElSgfdQrgX12C5X7wFGIYl9pv37l+vXLUQFDUXF9/wuuI COmwcEDFOL3B3sIepVRIj7Ko1ZKUwlPgvXpD2N21dUj73Dyc5vahf0QNtuhQr+bLealgkOs1XR3 P5UR2WNRnfMN93ZQvcNfdP80VHNx7YD0Ne6bIXxG1QpDxRigppjU/naQZYsvidJUx14kGExYsp4 0XkXQUHuJUCITcbWZgARJC+IoN93Mj9EW7peKpGQ0Wu/u1/xR6RyOvl6Ym+lbfQ6qe40SxqtYH8 aeRsYWwvvGOXN2ap54mATUD1gpXVAhyjm2F9aON6jagyh+wdNSfehYBONxIZc00aY94ZwYWMCgJ HHpBn2BGnVmP+Uidd53cMiWllpPfKeSWhOL8uTCIN7pPpNU X-Received: by 2002:a05:600c:8b6e:b0:49c:fc6e:8cbb with SMTP id 5b1f17b1804b1-49fe66f9fe3mr28311825e9.31.1790240734292; Thu, 24 Sep 2026 02:05:34 -0700 (PDT) Received: from DESKTOP-IR7J1S9.localdomain ([129.45.65.17]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49fe5dff204sm80100715e9.14.2026.09.24.02.05.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2026 02:05:33 -0700 (PDT) From: Drif Abdelmalek Mohamed Said To: David Howells Cc: netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Drif Abdelmalek Mohamed Said Subject: [PATCH RESEND] cachefiles: convert deprecated simple_strtoul() to kstrtoul() in percentage command handlers Date: Thu, 24 Sep 2026 10:05:30 +0100 Message-ID: <20260924090530.134-1-drifabdelmalekmohamedsaid@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Convert the six % percentage command handlers - cachefiles_daemon_frun(), _fcull(), _fstop(), _brun(), _bcull(), and _bstop() - from the deprecated simple_strtoul() to kstrtoul(). These are the only handlers in this file that take a trailing '%' after the number; other nearby commands take plain values and are unaffected. Since kstrtoul() requires the whole input to be a valid number, each handler now walks the digit run itself, checks it's followed by '%' and NUL, and temporarily null-terminates at the '%' to isolate the number for kstrtoul(), restoring it afterwards. Signed-off-by: Drif Abdelmalek Mohamed Said --- fs/cachefiles/daemon.c | 78 +++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c index 1a66e0af2837..12c38b366881 100644 --- a/fs/cachefiles/daemon.c +++ b/fs/cachefiles/daemon.c @@ -331,16 +331,25 @@ static int cachefiles_daemon_range_error(struct cache= files_cache *cache, static int cachefiles_daemon_frun(struct cachefiles_cache *cache, char *ar= gs) { unsigned long frun; + char *end =3D args; + int ret; =20 _enter(",%s", args); =20 if (!*args) return -EINVAL; =20 - frun =3D simple_strtoul(args, &args, 10); - if (args[0] !=3D '%' || args[1] !=3D '\0') + while (isdigit(*end)) + end++; + if (end =3D=3D args || *end !=3D '%' || end[1] !=3D '\0') return -EINVAL; =20 + *end =3D '\0'; + ret =3D kstrtoul(args, 10, &frun); + *end =3D '%'; + if (ret) + return ret; + if (frun <=3D cache->fcull_percent || frun >=3D 100) return cachefiles_daemon_range_error(cache, args); =20 @@ -355,16 +364,25 @@ static int cachefiles_daemon_frun(struct cachefiles_c= ache *cache, char *args) static int cachefiles_daemon_fcull(struct cachefiles_cache *cache, char *a= rgs) { unsigned long fcull; + char *end =3D args; + int ret; =20 _enter(",%s", args); =20 if (!*args) return -EINVAL; =20 - fcull =3D simple_strtoul(args, &args, 10); - if (args[0] !=3D '%' || args[1] !=3D '\0') + while (isdigit(*end)) + end++; + if (end =3D=3D args || *end !=3D '%' || end[1] !=3D '\0') return -EINVAL; =20 + *end =3D '\0'; + ret =3D kstrtoul(args, 10, &fcull); + *end =3D '%'; + if (ret) + return ret; + if (fcull <=3D cache->fstop_percent || fcull >=3D cache->frun_percent) return cachefiles_daemon_range_error(cache, args); =20 @@ -379,16 +397,25 @@ static int cachefiles_daemon_fcull(struct cachefiles_= cache *cache, char *args) static int cachefiles_daemon_fstop(struct cachefiles_cache *cache, char *a= rgs) { unsigned long fstop; + char *end =3D args; + int ret; =20 _enter(",%s", args); =20 if (!*args) return -EINVAL; =20 - fstop =3D simple_strtoul(args, &args, 10); - if (args[0] !=3D '%' || args[1] !=3D '\0') + while (isdigit(*end)) + end++; + if (end =3D=3D args || *end !=3D '%' || end[1] !=3D '\0') return -EINVAL; =20 + *end =3D '\0'; + ret =3D kstrtoul(args, 10, &fstop); + *end =3D '%'; + if (ret) + return ret; + if (fstop >=3D cache->fcull_percent) return cachefiles_daemon_range_error(cache, args); =20 @@ -403,16 +430,25 @@ static int cachefiles_daemon_fstop(struct cachefiles_= cache *cache, char *args) static int cachefiles_daemon_brun(struct cachefiles_cache *cache, char *ar= gs) { unsigned long brun; + char *end =3D args; + int ret; =20 _enter(",%s", args); =20 if (!*args) return -EINVAL; =20 - brun =3D simple_strtoul(args, &args, 10); - if (args[0] !=3D '%' || args[1] !=3D '\0') + while (isdigit(*end)) + end++; + if (end =3D=3D args || *end !=3D '%' || end[1] !=3D '\0') return -EINVAL; =20 + *end =3D '\0'; + ret =3D kstrtoul(args, 10, &brun); + *end =3D '%'; + if (ret) + return ret; + if (brun <=3D cache->bcull_percent || brun >=3D 100) return cachefiles_daemon_range_error(cache, args); =20 @@ -427,16 +463,25 @@ static int cachefiles_daemon_brun(struct cachefiles_c= ache *cache, char *args) static int cachefiles_daemon_bcull(struct cachefiles_cache *cache, char *a= rgs) { unsigned long bcull; + char *end =3D args; + int ret; =20 _enter(",%s", args); =20 if (!*args) return -EINVAL; =20 - bcull =3D simple_strtoul(args, &args, 10); - if (args[0] !=3D '%' || args[1] !=3D '\0') + while (isdigit(*end)) + end++; + if (end =3D=3D args || *end !=3D '%' || end[1] !=3D '\0') return -EINVAL; =20 + *end =3D '\0'; + ret =3D kstrtoul(args, 10, &bcull); + *end =3D '%'; + if (ret) + return ret; + if (bcull <=3D cache->bstop_percent || bcull >=3D cache->brun_percent) return cachefiles_daemon_range_error(cache, args); =20 @@ -451,16 +496,25 @@ static int cachefiles_daemon_bcull(struct cachefiles_= cache *cache, char *args) static int cachefiles_daemon_bstop(struct cachefiles_cache *cache, char *a= rgs) { unsigned long bstop; + char *end =3D args; + int ret; =20 _enter(",%s", args); =20 if (!*args) return -EINVAL; =20 - bstop =3D simple_strtoul(args, &args, 10); - if (args[0] !=3D '%' || args[1] !=3D '\0') + while (isdigit(*end)) + end++; + if (end =3D=3D args || *end !=3D '%' || end[1] !=3D '\0') return -EINVAL; =20 + *end =3D '\0'; + ret =3D kstrtoul(args, 10, &bstop); + *end =3D '%'; + if (ret) + return ret; + if (bstop >=3D cache->bcull_percent) return cachefiles_daemon_range_error(cache, args); =20 --=20 2.43.0