lkml.org 
[lkml]   [2019]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/6] ptrace: introduce ptrace_syscall_enter to consolidate PTRACE_SYSEMU handling
On Mon, Mar 04, 2019 at 10:46:43AM +0000, Sudeep Holla wrote:
> On Mon, Mar 04, 2019 at 08:03:47AM +0000, Haibo Xu (Arm Technology China) wrote:
> > On 2019/3/1 2:32, Sudeep Holla wrote:
> > > +long ptrace_syscall_enter(struct pt_regs *regs)
> > > +{
> > > +#ifdef TIF_SYSCALL_EMU
> > > + if (test_thread_flag(TIF_SYSCALL_EMU)) {
> > > + if (tracehook_report_syscall_entry(regs));
> >
> > Shall we remove the semi-colon at end of the above line?
>
> Added intentionally to keep GCC happy.

GCC warns because the user explicitly asked for it, with __must_check.
If you want to do things with an "if" like this, you should write e.g.

if (tracehook_report_syscall_entry(regs))
/*
* We can ignore the return code here, because of
* X and Y and Z.
*/
;

Or it probably is nicer to use a block:

if (tracehook_report_syscall_entry(regs)) {
/*
* We can ignore the return code here, because of
* X and Y and Z.
*/
}

The point is, you *always* should have a nice fat comment if you are
ignoring the return code of a __must_check function.


Segher

\
 
 \ /
  Last update: 2019-03-04 13:25    [W:0.050 / U:1.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site