lkml.org 
[lkml]   [2009]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch] x86: Unneeded assignment to tsk in recent x86 change
    Uros Bizjak writes:
    > Mikael Pettersson wrote:
    >
    > > > Impact: Cleanup.
    > > >
    > > > Remove unneeded assignment to tsk in recent x86 change [1].
    > >
    > >
    > > > @@ -795,13 +794,12 @@ asmlinkage
    > > > void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
    > > > {
    > > > unsigned long address;
    > > > - struct task_struct *tsk;
    > > > + struct task_struct *tsk = current;
    > > > struct mm_struct *mm;
    > > > struct vm_area_struct *vma;
    > > > int write;
    > > > int fault;
    > > >
    > > > - tsk = current;
    > > > mm = tsk->mm;
    > > > prefetchw(&mm->mmap_sem);
    > >
    > > but this is neither a fix nor IMO a cleanup (it's inconsistent with
    > > the other variables in that function)
    > >
    >
    > Hm, I'm not sure I see the inconsistency here. Care to explain this
    > inconsistency in a couple of words?

    You're initialising some variables in their declarations, and some
    using assignments at the start of the procedure body. In particular,
    for some reason you don't initialise 'mm' in its declaration even
    though you could do so for consistency with 'tsk'.

    However, I'm strongly in favour of separating declarations and
    initialisations (esp. ones that need actual computations), so
    rather than subjecting 'mm' to the treatment you gave 'tsk',
    just leave the code alone.


    \
     
     \ /
      Last update: 2009-01-21 22:17    [W:7.380 / U:0.128 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site