The Linux Kernel Mailing List
 help / color / mirror / Atom feed
  • * Re: [PATCH][next] perf/x86: Avoid multiple -Wflex-array-member-not-at-end warnings
           [not found] <afJcDg1I5ZU5ZkXf@kspp>
           [not found] ` <20260504083228.GQ3126523@noisy.programming.kicks-ass.net>
    @ 2026-05-07  8:46 ` Peter Zijlstra
      1 sibling, 0 replies; 4+ messages in thread
    From: Peter Zijlstra @ 2026-05-07  8:46 UTC (permalink / raw)
      To: Gustavo A. R. Silva
      Cc: Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
    	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
    	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
    	H. Peter Anvin, x86, linux-perf-users, linux-kernel,
    	linux-hardening
    
    On Wed, Apr 29, 2026 at 01:29:18PM -0600, Gustavo A. R. Silva wrote:
    
    > +	/*
    > +	 * Intel LBR bits
    > +	 */
    > +	int				lbr_users;
    > +	int				lbr_pebs_users;
    > +	union {
    > +		struct er_account		*lbr_sel;
    > +		struct er_account		*lbr_ctl;
    > +	};
    > +	u64				br_sel;
    > +	void				*last_task_ctx;
    > +	int				last_log_id;
    > +	int				lbr_select;
    > +	void				*lbr_xsave;
    > +
    > +	/* Must be last as it ends in a flexible-array member. */
    > +	TRAILING_OVERLAP(struct perf_branch_stack, lbr_stack, entries,
    > +		struct perf_branch_entry	lbr_entries[MAX_LBR_ENTRIES];
    > +		u64				lbr_counters[MAX_LBR_ENTRIES]; /* branch stack extra */
    > +	);
    
    FWIW, this thing is horrible crap. Per construction this thing does not
    need to be last at all, you can have multiple such constructs in a
    single structure and things would be perfectly fine.
    
    Also, your TRAILING_OVERLAP() thing should probably have
    __no_randomize_layout in ATTRS, rather than empty (and I'm assuming
    __packed implies __no_randomized_layout, otherwise 'fun' things can
    happen).
    
    >  };
    
    ^ permalink raw reply	[flat|nested] 4+ messages in thread

  • end of thread, other threads:[~2026-05-07 10:14 UTC | newest]
    
    Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <afJcDg1I5ZU5ZkXf@kspp>
         [not found] ` <20260504083228.GQ3126523@noisy.programming.kicks-ass.net>
    2026-05-04 19:50   ` [PATCH][next] perf/x86: Avoid multiple -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
    2026-05-07  8:10     ` Peter Zijlstra
    2026-05-07 10:14       ` Peter Zijlstra
    2026-05-07  8:46 ` Peter Zijlstra
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox