Patch "tracing: Avoid -Warray-bounds warning for __rel_loc macro" has been added to the 5.15-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

    tracing: Avoid -Warray-bounds warning for __rel_loc macro

to the 5.15-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:
     tracing-avoid-warray-bounds-warning-for-__rel_loc-ma.patch
and it can be found in the queue-5.15 subdirectory.

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



commit eddd09b8d3ad6134db6d0034a8254c45da0587c0
Author: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Date:   Tue Jan 25 23:19:30 2022 +0900

    tracing: Avoid -Warray-bounds warning for __rel_loc macro
    
    [ Upstream commit 58c5724ec2cdd72b22107ec5de00d90cc4797796 ]
    
    Since -Warray-bounds checks the destination size from the type of given
    pointer, __assign_rel_str() macro gets warned because it passes the
    pointer to the 'u32' field instead of 'trace_event_raw_*' data structure.
    Pass the data address calculated from the 'trace_event_raw_*' instead of
    'u32' __rel_loc field.
    
    Link: https://lkml.kernel.org/r/20220125233154.dac280ed36944c0c2fe6f3ac@xxxxxxxxxx
    
    Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
    Cc: Kees Cook <keescook@xxxxxxxxxxxx>
    Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
    [ This did not fix the warning, but is still a nice clean up ]
    Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
index 8c6f7c433518..65d927e059d3 100644
--- a/include/trace/trace_events.h
+++ b/include/trace/trace_events.h
@@ -318,9 +318,10 @@ TRACE_MAKE_SYSTEM_STR();
 #define __get_str(field) ((char *)__get_dynamic_array(field))
 
 #undef __get_rel_dynamic_array
-#define __get_rel_dynamic_array(field)	\
-		((void *)(&__entry->__rel_loc_##field) +	\
-		 sizeof(__entry->__rel_loc_##field) +		\
+#define __get_rel_dynamic_array(field)					\
+		((void *)__entry + 					\
+		 offsetof(typeof(*__entry), __rel_loc_##field) +	\
+		 sizeof(__entry->__rel_loc_##field) +			\
 		 (__entry->__rel_loc_##field & 0xffff))
 
 #undef __get_rel_dynamic_array_len



[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