Patch "perf map: Delete two variable initialisations before null pointer checks in sort__sym_from_cmp()" has been added to the 4.14-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

    perf map: Delete two variable initialisations before null pointer checks in sort__sym_from_cmp()

to the 4.14-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:
     perf-map-delete-two-variable-initialisations-before-.patch
and it can be found in the queue-4.14 subdirectory.

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



commit cd584e0ac59fae5d58a2c061fa85e04850a0e913
Author: Markus Elfring <Markus.Elfring@xxxxxx>
Date:   Thu Apr 13 14:46:39 2023 +0200

    perf map: Delete two variable initialisations before null pointer checks in sort__sym_from_cmp()
    
    [ Upstream commit c160118a90d4acf335993d8d59b02ae2147a524e ]
    
    Addresses of two data structure members were determined before
    corresponding null pointer checks in the implementation of the function
    “sort__sym_from_cmp”.
    
    Thus avoid the risk for undefined behaviour by removing extra
    initialisations for the local variables “from_l” and “from_r” (also
    because they were already reassigned with the same value behind this
    pointer check).
    
    This issue was detected by using the Coccinelle software.
    
    Fixes: 1b9e97a2a95e4941 ("perf tools: Fix report -F symbol_from for data without branch info")
    Signed-off-by: <elfring@xxxxxxxxxxxxxxxxxxxxx>
    Acked-by: Ian Rogers <irogers@xxxxxxxxxx>
    Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
    Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
    Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
    Cc: German Gomez <german.gomez@xxxxxxx>
    Cc: Ingo Molnar <mingo@xxxxxxxxxx>
    Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
    Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
    Link: https://lore.kernel.org/cocci/54a21fea-64e3-de67-82ef-d61b90ffad05@xxxxxx/
    Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index cd870129131e1..4fe2f3f92ab11 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -753,8 +753,7 @@ static int hist_entry__dso_to_filter(struct hist_entry *he, int type,
 static int64_t
 sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right)
 {
-	struct addr_map_symbol *from_l = &left->branch_info->from;
-	struct addr_map_symbol *from_r = &right->branch_info->from;
+	struct addr_map_symbol *from_l, *from_r;
 
 	if (!left->branch_info || !right->branch_info)
 		return cmp_null(left->branch_info, right->branch_info);



[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