lkml.org 
[lkml]   [2018]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/2] jump_label: Explicitly disable jump labels in __init code
On Sat, 17 Feb 2018, Josh Poimboeuf wrote:
> On Sat, Feb 17, 2018 at 11:38:48AM +0100, Ingo Molnar wrote:
> >
> > * Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > > +/* Disable any jump label entries in __init code */
> > > +void __init jump_label_invalidate_init(void)
> > > +{
> > > + struct jump_entry *iter_start = __start___jump_table;
> > > + struct jump_entry *iter_stop = __stop___jump_table;
> > > + struct jump_entry *iter;
> > > +
> > > + for (iter = iter_start; iter < iter_stop; iter++)
> > > + if (iter->code >= (unsigned long)_sinittext &&
> > > + iter->code < (unsigned long)_einittext)
> > > + iter->code = 0;
> > > +}
> > > +
> > > +/* Disable any jump label entries in module init code */
> > > static void jump_label_invalidate_module_init(struct module *mod)
> > > {
> > > struct jump_entry *iter_start = mod->jump_entries;
> > > struct jump_entry *iter_stop = iter_start + mod->num_jump_entries;
> > > struct jump_entry *iter;
> > >
> > > - for (iter = iter_start; iter < iter_stop; iter++) {
> > > + for (iter = iter_start; iter < iter_stop; iter++)
> > > if (within_module_init(iter->code, mod))
> > > iter->code = 0;
> > > - }
> >
> > Why did you remove the curly braces? They are canonical kernel style for
> > multi-line statements.
>
> Personally I prefer the more compact version, but I have no problem
> changing it.

Yes, it's certainly a matter of taste. Here is the reason why myself and
others prefer the version with braces:

https://marc.info/?l=linux-kernel&m=148467980905537&w=2

Thanks,

tglx

\
 
 \ /
  Last update: 2018-02-17 21:13    [W:0.065 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site