Linux Security Modules development
 help / color / mirror / Atom feed
* [PATCH] lockdown: remove useless decrement operation
@ 2026-05-01 17:44 Kalevi Kolttonen
  2026-05-05  9:20 ` Nicolas Bouchinet
  2026-05-05  9:51 ` Nicolas Bouchinet
  0 siblings, 2 replies; 4+ messages in thread
From: Kalevi Kolttonen @ 2026-05-01 17:44 UTC (permalink / raw)
  To: linux-security-module; +Cc: Kalevi Kolttonen

Signed-off-by: Kalevi Kolttonen <kalevi@kolttonen.fi>
---
 security/lockdown/lockdown.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c
index 8d46886d2cca..2659d36bb74c 100644
--- a/security/lockdown/lockdown.c
+++ b/security/lockdown/lockdown.c
@@ -130,10 +130,8 @@ static ssize_t lockdown_write(struct file *file, const char __user *buf,
 		return PTR_ERR(state);
 
 	len = strlen(state);
-	if (len && state[len-1] == '\n') {
+	if (len && state[len-1] == '\n')
 		state[len-1] = '\0';
-		len--;
-	}
 
 	for (i = 0; i < ARRAY_SIZE(lockdown_levels); i++) {
 		enum lockdown_reason level = lockdown_levels[i];
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] lockdown: remove useless decrement operation
  2026-05-01 17:44 [PATCH] lockdown: remove useless decrement operation Kalevi Kolttonen
@ 2026-05-05  9:20 ` Nicolas Bouchinet
  2026-05-05  9:51 ` Nicolas Bouchinet
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Bouchinet @ 2026-05-05  9:20 UTC (permalink / raw)
  To: Kalevi Kolttonen
  Cc: linux-security-module, Cai Xinchen, Xiujianfeng, Xiujianfeng

Hi Kalevi, 

Thanks for your contribution,

While it is true that the len variable decrement is not used anywhere
and that removing it would be cleaner, this patch does not otherwise
bring any direct benefits.

Ideally we should go through the full Lockdown code to clean it, I'll
include it with Cai's one[1] when a more consequent patch will be ready.
I'll thus keep those somewhere until then.

I have a two week holiday starting this Friday and will thus not be
available until the 26th of may. Xiu, and Cai, if you want to work on it
I'll gladly review the patchset.

Best regards,

Nicolas

[1]: https://lore.kernel.org/all/20260119091226.3195309-1-caixinchen1@huawei.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lockdown: remove useless decrement operation
  2026-05-01 17:44 [PATCH] lockdown: remove useless decrement operation Kalevi Kolttonen
  2026-05-05  9:20 ` Nicolas Bouchinet
@ 2026-05-05  9:51 ` Nicolas Bouchinet
  2026-05-07  9:38   ` Xiu Jianfeng
  1 sibling, 1 reply; 4+ messages in thread
From: Nicolas Bouchinet @ 2026-05-05  9:51 UTC (permalink / raw)
  To: Kalevi Kolttonen; +Cc: linux-security-module, Xiujianfeng, Xiujianfeng

Hi Kalevi, thanks for your contribution,

While it is true the len variable decrementing is not used anywhere and
that it would be cleaner to remove it, ideally we should go through a
more in depth Lockdown code cleaning.
I'll include it with Cai's one[1] when a more consequent patch will be
ready. I'll thus keep it somewhere with the patch until then.

I have a two week holiday starting this Friday and will thus not be available
until the 26th of may. Xiu, and Cai, if you want to work on it I'll gladly
review the patch set.

[1]: https://lore.kernel.org/all/20260119091226.3195309-1-caixinchen1@huawei.com/

Best regards,

Nicolas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] lockdown: remove useless decrement operation
  2026-05-05  9:51 ` Nicolas Bouchinet
@ 2026-05-07  9:38   ` Xiu Jianfeng
  0 siblings, 0 replies; 4+ messages in thread
From: Xiu Jianfeng @ 2026-05-07  9:38 UTC (permalink / raw)
  To: Nicolas Bouchinet, Kalevi Kolttonen; +Cc: linux-security-module, xiujianfeng

On 5/5/2026 5:51 PM, Nicolas Bouchinet wrote:
> Hi Kalevi, thanks for your contribution,
> 
> While it is true the len variable decrementing is not used anywhere and
> that it would be cleaner to remove it, ideally we should go through a
> more in depth Lockdown code cleaning.
> I'll include it with Cai's one[1] when a more consequent patch will be
> ready. I'll thus keep it somewhere with the patch until then.
> 
> I have a two week holiday starting this Friday and will thus not be available
> until the 26th of may. Xiu, and Cai, if you want to work on it I'll gladly
> review the patch set.

Hi Nicolas,

Have a nice holiday!

I'm in favor of a cleanup where it makes sense, but I don't see any
code that specifically needs it at the moment. Feel free to point out
any areas of concern when you have a moment.

> 
> [1]: https://lore.kernel.org/all/20260119091226.3195309-1-caixinchen1@huawei.com/
> 
> Best regards,
> 
> Nicolas


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-07  9:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-01 17:44 [PATCH] lockdown: remove useless decrement operation Kalevi Kolttonen
2026-05-05  9:20 ` Nicolas Bouchinet
2026-05-05  9:51 ` Nicolas Bouchinet
2026-05-07  9:38   ` Xiu Jianfeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox