Patch "libbpf: Fix str_has_sfx()'s return value" has been added to the 5.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    libbpf: Fix str_has_sfx()'s return value

to the 5.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     libbpf-fix-str_has_sfx-s-return-value.patch
and it can be found in the queue-5.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b6a909f1d6874b846e7a0958c5c89751bfd339eb
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Tue Jul 19 12:53:01 2022 +0300

    libbpf: Fix str_has_sfx()'s return value
    
    [ Upstream commit 14229b8153a3ca51d97a22a18c68deeae64afce0 ]
    
    The return from strcmp() is inverted so it wrongly returns true instead
    of false and vice versa.
    
    Fixes: a1c9d61b19cb ("libbpf: Improve library identification for uprobe binary path resolution")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Acked-by: Martin KaFai Lau <kafai@xxxxxx>
    Cc: Alan Maguire <alan.maguire@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/YtZ+/dAA195d99ak@kili
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h
index ef5d975078e5..230ac5699c3d 100644
--- a/tools/lib/bpf/libbpf_internal.h
+++ b/tools/lib/bpf/libbpf_internal.h
@@ -109,9 +109,9 @@ static inline bool str_has_sfx(const char *str, const char *sfx)
 	size_t str_len = strlen(str);
 	size_t sfx_len = strlen(sfx);
 
-	if (sfx_len <= str_len)
-		return strcmp(str + str_len - sfx_len, sfx);
-	return false;
+	if (sfx_len > str_len)
+		return false;
+	return strcmp(str + str_len - sfx_len, sfx) == 0;
 }
 
 /* Symbol versioning is different between static and shared library.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux