Skip to contentSkip to conversation

drm/amd/pm: Add empty string validation to sysfs store functions

PATCH In review [email protected] 4 participants 7 messages Apr 30 – May 15

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/amd/pm: Add empty string validation to sysfs store functions

From: Vitaly Prosyak <[email protected]>

Discovery: Fuzzing for secure supply chain requirements
Tool: amd_fuzzing_sysfs (IGT test)

The AMDGPU power management sysfs store functions accept whitespace-only strings when they should reject them with -EINVAL. This was discovered via systematic fuzzing of sysfs interfaces crossing the user/kernel trust boundary.

Affected functions:
- amdgpu_set_power_dpm_force_performance_level (power_dpm_force_performance_level)
- amdgpu_set_power_dpm_state (power_dpm_state)
- amdgpu_set_pp_power_profile_mode (pp_power_profile_mode)
- amdgpu_read_mask (used by pp_dpm_sclk/mclk/fclk/socclk/pcie)
- amdgpu_set_pp_features (pp_features)

Impact:
- Whitespace-only writes (e.g., "\n", " ") can cause unexpected behavior
- Better input validation at user/kernel trust boundary
- Defense-in-depth improvement

Root Cause:
The sysfs_streq() function matches whitespace-only strings against empty string, allowing invalid input to be processed.

Fix:
Add explicit validation at the start of each affected store function:

    if (count == 0 || sysfs_streq(buf, ""))
        return -EINVAL;

This rejects whitespace-only inputs before they are processed. Note that write() calls with count=0 (truly empty strings) are handled by the VFS layer before reaching the sysfs .store() callback - the VFS returns 0 (success) without calling the kernel function. This is POSIX-compliant behavior and cannot be changed at the kernel driver level.

What This Patch Fixes:
- Whitespace-only strings: "\n", " ", " ", etc. are now rejected
- Defense-in-depth: Explicit validation at trust boundary
- Code clarity: Intent to reject invalid input is explicit

What This Patch Cannot Fix:
- write(fd, "", 0) returning success - this is VFS layer behavior
- Fuzzer tests for empty strings (count=0) will still report "accepted" because the VFS handles this before the kernel callback

Test Results After Fix:
- Whitespace strings ("\n", " ") now properly rejected
- Empty string tests (count=0) still show as "accepted" due to VFS behavior
- Overall improvement in input validation robustness
- No impact on valid inputs

This is a defense-in-depth improvement that hardens input validation even though VFS layer behavior prevents catching all edge cases.

Tested: amd_fuzzing_sysfs IGT test

Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +20 -0
index fd2e63530e8c..66d8466b166a 100644
@@ -244,6 +244,10 @@ static ssize_t amdgpu_set_power_dpm_state(struct device *dev,
 	enum amd_pm_state_type  state;
 	int ret;
 
+	/* Reject empty/whitespace strings - fuzzing found this is not validated */
+	if (count == 0 || sysfs_streq(buf, ""))
+		return -EINVAL;
+
 	if (sysfs_streq(buf, "battery"))
 		state = POWER_STATE_TYPE_BATTERY;
 	else if (sysfs_streq(buf, "balanced"))
@@ -364,6 +368,10 @@ static ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev,
 	enum amd_dpm_forced_level level;
 	int ret = 0;
 
+	/* Reject empty/whitespace strings - fuzzing found this is not validated */
+	if (count == 0 || sysfs_streq(buf, ""))
+		return -EINVAL;
+
 	if (sysfs_streq(buf, "low"))
 		level = AMD_DPM_FORCED_LEVEL_LOW;
 	else if (sysfs_streq(buf, "high"))
@@ -902,6 +910,10 @@ static ssize_t amdgpu_set_pp_features(struct device *dev,
 	uint64_t featuremask;
 	int ret;
 
+	/* Reject empty/whitespace strings - fuzzing found kstrtou64 accepts "" as 0 */
+	if (count == 0 || sysfs_streq(buf, ""))
+		return -EINVAL;
+
 	ret = kstrtou64(buf, 0, &featuremask);
 	if (ret)
 		return -EINVAL;
@@ -1027,6 +1039,10 @@ static ssize_t amdgpu_read_mask(const char *buf, size_t count, uint32_t *mask)
 
 	*mask = 0;
 
+	/* Reject empty/whitespace strings - fuzzing found this is not validated */
+	if (count == 0 || sysfs_streq(buf, ""))
+		return -EINVAL;
+
 	bytes = min(count, sizeof(buf_cpy) - 1);
 	memcpy(buf_cpy, buf, bytes);
 	buf_cpy[bytes] = '\0';
@@ -1378,6 +1394,10 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
 	long int profile_mode = 0;
 	const char delimiter[3] = {' ', '\n', '\0'};
 
+	/* Reject empty/whitespace strings - fuzzing found this is not validated */
+	if (count == 0 || sysfs_streq(buf, ""))
+		return -EINVAL;
+
 	tmp[0] = *(buf);
 	tmp[1] = '\0';
 	ret = kstrtol(tmp, 0, &profile_mode);
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/3 drm/amd/pm: Reject negative values in thermal_throttling_logging

From: Vitaly Prosyak <[email protected]>

Discovery: Fuzzing for secure supply chain requirements
Tool: amd_fuzzing_sysfs (IGT test)

The thermal_throttling_logging sysfs store function accepts negative values like -1 and -9999999, which are nonsensical for a logging interval.

Current behavior:
- Values <= 0 disable logging (intended for 0 only)
- Values 1-3600 enable logging with interval in seconds
- Negative values are accepted and treated as disable

Issue:
Large negative values like -9999999 make no semantic sense and could indicate input validation bypass attempts. While they functionally disable logging (same as 0), accepting arbitrary negative values suggests inadequate input validation.

Fix:
Add explicit check to reject values < 0 before processing. Only accept:
- 0: disable thermal throttling logging
- 1-3600: enable with interval in seconds (existing validation)

This improves input validation and makes the interface more robust.

Test Results Before Fix:
thermal_throttling_logging: 6 failures
- Accepted: 0, -1, -9999999, -2147483648, empty string, 0777

Test Results After Fix:
thermal_throttling_logging: 3 failures
- Rejected: -1, -9999999, -2147483648 (now return -EINVAL)
- Remaining: empty string (VFS behavior), 0 (valid), 0777 (octal)

Tested: amd_fuzzing_sysfs IGT test

Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4 -0
index 66d8466b166a..1ef741f4c43f 100644
@@ -1634,6 +1634,10 @@ static ssize_t amdgpu_set_thermal_throttling_logging(struct device *dev,
 	if (ret)
 		return ret;
 
+	/* Reject negative values - only 0 (disable) or 1-3600 (seconds) are valid */
+	if (throttling_logging_interval < 0)
+		return -EINVAL;
+
 	if (throttling_logging_interval > 3600)
 		return -EINVAL;
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 2/3
#2 lore raw

RE: [PATCH 2/3] drm/amd/pm: Reject negative values in thermal_throttling_logging

Public

Quoted 47 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of [email protected]
Sent: Thursday, April 30, 2026 4:14 PM
To: [email protected]
Cc: Prosyak, Vitaly <[email protected]>; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 2/3] drm/amd/pm: Reject negative values in thermal_throttling_logging

From: Vitaly Prosyak <[email protected]>

Discovery: Fuzzing for secure supply chain requirements
Tool: amd_fuzzing_sysfs (IGT test)

The thermal_throttling_logging sysfs store function accepts negative values like -1 and -9999999, which are nonsensical for a logging interval.

Current behavior:
- Values <= 0 disable logging (intended for 0 only)
- Values 1-3600 enable logging with interval in seconds
- Negative values are accepted and treated as disable

Issue:
Large negative values like -9999999 make no semantic sense and could indicate input validation bypass attempts. While they functionally disable logging (same as 0), accepting arbitrary negative values suggests inadequate input validation.

Fix:
Add explicit check to reject values < 0 before processing. Only accept:
- 0: disable thermal throttling logging
- 1-3600: enable with interval in seconds (existing validation)

This improves input validation and makes the interface more robust.

Test Results Before Fix:
thermal_throttling_logging: 6 failures
- Accepted: 0, -1, -9999999, -2147483648, empty string, 0777

Test Results After Fix:
thermal_throttling_logging: 3 failures
- Rejected: -1, -9999999, -2147483648 (now return -EINVAL)
- Remaining: empty string (VFS behavior), 0 (valid), 0777 (octal)

Quoted 6 lines

Tested: amd_fuzzing_sysfs IGT test

Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jesse Zhang <[email protected]>
Quoted 24 lines
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -0
index 66d8466b166a..1ef741f4c43f 100644
@@ -1634,6 +1634,10 @@ static ssize_t
 amdgpu_set_thermal_throttling_logging(struct device *dev,
      if (ret)
              return ret;
 
+     /* Reject negative values - only 0 (disable) or 1-3600 (seconds) are

valid */

drivers/gpu/drm/amd/pm/amdgpu_pm.c +3 -1
+     if (throttling_logging_interval < 0)
+             return -EINVAL;
+
      if (throttling_logging_interval > 3600)
              return -EINVAL;
 
--

2.43.0

#3 lore raw

PATCH 3/3 drm/amdkfd: Add input validation for SET_XNACK_MODE ioctl

In reply to [email protected]

From: Vitaly Prosyak <[email protected]>

The AMDKFD_IOC_SET_XNACK_MODE ioctl accepts any arbitrary 32-bit value without validation. According to the UAPI documentation, only three values are valid:
-1: Query current XNACK mode (read-only operation)
0: Disable XNACK mode
1: Enable XNACK mode

Currently, the ioctl accepts invalid values like 0xDEADBEEF, 0xFFFFFFFF, 0x7FFFFFFF without returning an error. While the kernel internally treats any positive value as "enabled", accepting garbage values violates the principle of strict input validation at the kernel/userspace boundary.

This patch adds validation to reject values outside the documented range [-1, 1], improving robustness and catching potential userspace bugs early.

Discovery: Found through systematic fuzzing of KFD IOCTLs using the IGT amd_fuzzing_kfd test, which revealed that all fuzz patterns (0xDEADBEEF, 0xFFFFFFFF, etc.) were accepted without error.

Cc Felix Kuehling <[email protected]>
Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jesse Zhang <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +7 -0
index 881ea252b3ad..57bd1e78b3e5 100644
@@ -1716,6 +1716,13 @@ static int kfd_ioctl_set_xnack_mode(struct file *filep,
 	struct kfd_ioctl_set_xnack_mode_args *args = data;
 	int r = 0;
 
+	/* Validate input: only -1 (query), 0 (disable), or 1 (enable) allowed */
+	if (args->xnack_enabled < -1 || args->xnack_enabled > 1) {
+		pr_debug("Invalid xnack_enabled value: %d (must be -1, 0, or 1)\n",
+			 args->xnack_enabled);
+		return -EINVAL;
+	}
+
 	mutex_lock(&p->mutex);
 	if (args->xnack_enabled >= 0) {
 		if (!list_empty(&p->pqm.queues)) {
Signature · 1 line
2.43.0
maintainer
#4 lore raw

Re: [PATCH 3/3] drm/amdkfd: Add input validation for SET_XNACK_MODE ioctl

Quoted 9 lines · On 2026-04-30 16:14, [email protected] wrote:

From: Vitaly Prosyak <[email protected]>

The AMDKFD_IOC_SET_XNACK_MODE ioctl accepts any arbitrary 32-bit value without validation. According to the UAPI documentation, only three values are valid:
-1: Query current XNACK mode (read-only operation)
0: Disable XNACK mode
1: Enable XNACK mode

Quoted 4 lines

Currently, the ioctl accepts invalid values like 0xDEADBEEF, 0xFFFFFFFF, 0x7FFFFFFF without returning an error. While the kernel internally treats any positive value as "enabled", accepting garbage values violates the principle of strict input validation at the kernel/userspace boundary.

I disagree with this statement. E.g. for boolean, it's common that 0 means false and anything non-0 means true. In this case it's extended to 0: disable, positive: enable, negative: query. This is also how the API is documented in kfd_ioctl.h. I don't see why accepting values outside the range -1..1 is a bad thing as long as that doesn't cause undefined behaviour.

Your patch is changing the API semantics. If you really want to do that, you should also update the API documentation in kfd_ioctl.h and consider whether that may break existing user mode.

Regards,
  Felix

Quoted 35 lines

This patch adds validation to reject values outside the documented range [-1, 1], improving robustness and catching potential userspace bugs early.

Discovery: Found through systematic fuzzing of KFD IOCTLs using the IGT amd_fuzzing_kfd test, which revealed that all fuzz patterns (0xDEADBEEF, 0xFFFFFFFF, etc.) were accepted without error.

Cc Felix Kuehling <[email protected]>
Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jesse Zhang <[email protected]>
---
  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +7 -0
index 881ea252b3ad..57bd1e78b3e5 100644
@@ -1716,6 +1716,13 @@ static int kfd_ioctl_set_xnack_mode(struct file *filep,
  	struct kfd_ioctl_set_xnack_mode_args *args = data;
  	int r = 0;
 
+	/* Validate input: only -1 (query), 0 (disable), or 1 (enable) allowed */
+	if (args->xnack_enabled < -1 || args->xnack_enabled > 1) {
+		pr_debug("Invalid xnack_enabled value: %d (must be -1, 0, or 1)\n",
+			 args->xnack_enabled);
+		return -EINVAL;
+	}
+
  	mutex_lock(&p->mutex);
  	if (args->xnack_enabled >= 0) {
  		if (!list_empty(&p->pqm.queues)) {
#5 lore raw

Re: [PATCH 3/3] drm/amdkfd: Add input validation for SET_XNACK_MODE ioctl

Quoted 21 lines · Felix
Quoted 9 lines · On 2026-04-30 16:14, [email protected] wrote:

From: Vitaly Prosyak <[email protected]>

The AMDKFD_IOC_SET_XNACK_MODE ioctl accepts any arbitrary 32-bit value without validation. According to the UAPI documentation, only three values are valid:
-1: Query current XNACK mode (read-only operation)
0: Disable XNACK mode
1: Enable XNACK mode

Quoted 4 lines

Currently, the ioctl accepts invalid values like 0xDEADBEEF, 0xFFFFFFFF, 0x7FFFFFFF without returning an error. While the kernel internally treats any positive value as "enabled", accepting garbage values violates the principle of strict input validation at the kernel/userspace boundary.

I disagree with this statement. E.g. for boolean, it's common that 0 means false and anything non-0 means true. In this case it's extended to 0: disable, positive: enable, negative: query. This is also how the API is documented in kfd_ioctl.h. I don't see why accepting values outside the range -1..1 is a bad thing as long as that doesn't cause undefined behaviour.

Quoted 3 lines

Your patch is changing the API semantics. If you really want to do that, you should also update the API documentation in kfd_ioctl.h and consider whether that may break existing user mode.

Thank you for the  feedback and clarification on the API semantics.

You're  right - I misinterpreted the UAPI documentation. After reviewing again the actual comment in kfd_ioctl.h

"0 means disabled, positive means enabled, negative means leave unchanged"

My patch would have broken existing usermode that relies on this behavior, which is unacceptable.

I am withdrawing this patch and will drop the corresponding subtest from the IGT amd_fuzzing_kfd test suite.

Thanks, Vitaly

Quoted 38 lines

Regards,
  Felix

Quoted 34 lines

This patch adds validation to reject values outside the documented range [-1, 1], improving robustness and catching potential userspace bugs early.

Discovery: Found through systematic fuzzing of KFD IOCTLs using the IGT amd_fuzzing_kfd test, which revealed that all fuzz patterns (0xDEADBEEF, 0xFFFFFFFF, etc.) were accepted without error.

Cc Felix Kuehling <[email protected]>
Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jesse Zhang <[email protected]>
---
  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +7 -0
index 881ea252b3ad..57bd1e78b3e5 100644
@@ -1716,6 +1716,13 @@ static int kfd_ioctl_set_xnack_mode(struct file *filep,
  	struct kfd_ioctl_set_xnack_mode_args *args = data;
  	int r = 0;
 
+	/* Validate input: only -1 (query), 0 (disable), or 1 (enable) allowed */
+	if (args->xnack_enabled < -1 || args->xnack_enabled > 1) {
+		pr_debug("Invalid xnack_enabled value: %d (must be -1, 0, or 1)\n",
+			 args->xnack_enabled);
+		return -EINVAL;
+	}
+
  	mutex_lock(&p->mutex);
  	if (args->xnack_enabled >= 0) {
  		if (!list_empty(&p->pqm.queues)) {
maintainer Acked-by on v1 1/3
#6 lore raw
In reply to [email protected]

Public

Quoted 68 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, April 30, 2026 4:14 PM
To: [email protected]
Cc: Prosyak, Vitaly <[email protected]>; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 1/3] drm/amd/pm: Add empty string validation to sysfs store functions

From: Vitaly Prosyak <[email protected]>

Discovery: Fuzzing for secure supply chain requirements
Tool: amd_fuzzing_sysfs (IGT test)

The AMDGPU power management sysfs store functions accept whitespace- only strings when they should reject them with -EINVAL. This was discovered via systematic fuzzing of sysfs interfaces crossing the user/kernel trust boundary.

Affected functions:
- amdgpu_set_power_dpm_force_performance_level (power_dpm_force_performance_level)
- amdgpu_set_power_dpm_state (power_dpm_state)
- amdgpu_set_pp_power_profile_mode (pp_power_profile_mode)
- amdgpu_read_mask (used by pp_dpm_sclk/mclk/fclk/socclk/pcie)
- amdgpu_set_pp_features (pp_features)

Impact:
- Whitespace-only writes (e.g., "\n", " ") can cause unexpected behavior
- Better input validation at user/kernel trust boundary
- Defense-in-depth improvement

Root Cause:
The sysfs_streq() function matches whitespace-only strings against empty string, allowing invalid input to be processed.

Fix:
Add explicit validation at the start of each affected store function:

    if (count == 0 || sysfs_streq(buf, ""))
        return -EINVAL;

This rejects whitespace-only inputs before they are processed. Note that write() calls with count=0 (truly empty strings) are handled by the VFS layer before reaching the sysfs .store() callback - the VFS returns 0 (success) without calling the kernel function. This is POSIX-compliant behavior and cannot be changed at the kernel driver level.

What This Patch Fixes:
- Whitespace-only strings: "\n", " ", " ", etc. are now rejected
- Defense-in-depth: Explicit validation at trust boundary
- Code clarity: Intent to reject invalid input is explicit

What This Patch Cannot Fix:
- write(fd, "", 0) returning success - this is VFS layer behavior
- Fuzzer tests for empty strings (count=0) will still report "accepted" because the VFS handles this before the kernel callback

Test Results After Fix:
- Whitespace strings ("\n", " ") now properly rejected
- Empty string tests (count=0) still show as "accepted" due to VFS behavior
- Overall improvement in input validation robustness
- No impact on valid inputs

This is a defense-in-depth improvement that hardens input validation even though VFS layer behavior prevents catching all edge cases.

Quoted 6 lines

Tested: amd_fuzzing_sysfs IGT test

Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Jesse Zhang <[email protected]>
Quoted 75 lines
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -0
index fd2e63530e8c..66d8466b166a 100644
@@ -244,6 +244,10 @@ static ssize_t amdgpu_set_power_dpm_state(struct
 device *dev,
      enum amd_pm_state_type  state;
      int ret;
 
+     /* Reject empty/whitespace strings - fuzzing found this is not

validated */

drivers/gpu/drm/amd/pm/amdgpu_pm.c +3 -0
+     if (count == 0 || sysfs_streq(buf, ""))
+             return -EINVAL;
+
      if (sysfs_streq(buf, "battery"))
              state = POWER_STATE_TYPE_BATTERY;
      else if (sysfs_streq(buf, "balanced")) @@ -364,6 +368,10 @@ static

ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev,

      enum amd_dpm_forced_level level;
      int ret = 0;

+ /* Reject empty/whitespace strings - fuzzing found this is not
validated */

drivers/gpu/drm/amd/pm/amdgpu_pm.c +4 -0
+     if (count == 0 || sysfs_streq(buf, ""))
+             return -EINVAL;
+
      if (sysfs_streq(buf, "low"))
              level = AMD_DPM_FORCED_LEVEL_LOW;
      else if (sysfs_streq(buf, "high"))
@@ -902,6 +910,10 @@ static ssize_t amdgpu_set_pp_features(struct device
 *dev,
      uint64_t featuremask;
      int ret;
 
+     /* Reject empty/whitespace strings - fuzzing found kstrtou64 accepts

"" as 0 */

drivers/gpu/drm/amd/pm/amdgpu_pm.c +4 -0
+     if (count == 0 || sysfs_streq(buf, ""))
+             return -EINVAL;
+
      ret = kstrtou64(buf, 0, &featuremask);
      if (ret)
              return -EINVAL;
@@ -1027,6 +1039,10 @@ static ssize_t amdgpu_read_mask(const char
 *buf, size_t count, uint32_t *mask)
 
      *mask = 0;
 
+     /* Reject empty/whitespace strings - fuzzing found this is not

validated */

drivers/gpu/drm/amd/pm/amdgpu_pm.c +4 -0
+     if (count == 0 || sysfs_streq(buf, ""))
+             return -EINVAL;
+
      bytes = min(count, sizeof(buf_cpy) - 1);
      memcpy(buf_cpy, buf, bytes);
      buf_cpy[bytes] = '\0';
@@ -1378,6 +1394,10 @@ static ssize_t
 amdgpu_set_pp_power_profile_mode(struct device *dev,
      long int profile_mode = 0;
      const char delimiter[3] = {' ', '\n', '\0'};
 
+     /* Reject empty/whitespace strings - fuzzing found this is not

validated */

drivers/gpu/drm/amd/pm/amdgpu_pm.c +3 -1
+     if (count == 0 || sysfs_streq(buf, ""))
+             return -EINVAL;
+
      tmp[0] = *(buf);
      tmp[1] = '\0';
      ret = kstrtol(tmp, 0, &profile_mode);
--

2.43.0