diff mbox series

[nft] mnl: fix basehook comparison

Message ID 20241122220449.63682-1-donald.yandt@gmail.com
State Accepted
Headers show
Series [nft] mnl: fix basehook comparison | expand

Commit Message

Donald Yandt Nov. 22, 2024, 10:04 p.m. UTC
When comparing two hooks, if both device names are null,
the comparison should return true, as they are considered equal.

Signed-off-by: Donald Yandt <donald.yandt@gmail.com>
---
 src/mnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Phil Sutter Nov. 23, 2024, 12:21 p.m. UTC | #1
On Fri, Nov 22, 2024 at 05:04:49PM -0500, Donald Yandt wrote:
> When comparing two hooks, if both device names are null,
> the comparison should return true, as they are considered equal.
> 

Fixes: b8872b83eb365 ("src: mnl: prepare for listing all device netdev device hooks")

> Signed-off-by: Donald Yandt <donald.yandt@gmail.com>

Acked-by: Phil Sutter <phil@nwl.cc>
Phil Sutter Nov. 29, 2024, 4:26 p.m. UTC | #2
On Fri, Nov 22, 2024 at 05:04:49PM -0500, Donald Yandt wrote:
> When comparing two hooks, if both device names are null,
> the comparison should return true, as they are considered equal.
> 
> Signed-off-by: Donald Yandt <donald.yandt@gmail.com>

Patch applied, thanks!
diff mbox series

Patch

diff --git a/src/mnl.c b/src/mnl.c
index 828006c4..88fac5bd 100644
--- a/src/mnl.c
+++ b/src/mnl.c
@@ -2204,7 +2204,7 @@  static bool basehook_eq(const struct basehook *prev, const struct basehook *hook
 	if (prev->devname != NULL && hook->devname != NULL)
 		return strcmp(prev->devname, hook->devname) == 0;
 
-	if (prev->devname == NULL && prev->devname == NULL)
+	if (prev->devname == NULL && hook->devname == NULL)
 		return true;
 
 	return false;