Thread (15 messages) 15 messages, 5 authors, 2024-09-04

Re: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper

From: Hongbo Li <lihongbo22@huawei.com>
Date: 2024-09-02 01:28:00
Also in: linux-hardening, linux-mm


On 2024/9/1 4:07, Jakub Kicinski wrote:
On Sat, 31 Aug 2024 17:58:38 +0800 Hongbo Li wrote:
quoted
Use str_disabled_enabled() helper instead of open
coding the same.
quoted
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 6fe5e8f7017c..29647704bda8 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3178,7 +3178,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
  
  		/* [unimplemented] */
  		netif_info(tun, drv, tun->dev, "ignored: set checksum %s\n",
-			   arg ? "disabled" : "enabled");
+			   str_disabled_enabled(arg));
You don't explain the 'why'. How is this an improvement?
nack on this and 2 similar networking changes you sent
This just give an example of using lib/string_choices' helper which 
prevents the function from being removed due to detection of non-use. 
These helpers are convenient. It's functionally equivalent, this avoids 
the dispersion of such writing styles( ? XXX : noXXX) everywhere.

Thanks,
Hongbo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help