All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Tomas Bortoli <tomasbortoli@gmail.com>
Cc: kbuild-all@01.org, vyasevich@gmail.com, nhorman@tuxdriver.com,
	marcelo.leitner@gmail.com, davem@davemloft.net,
	linux-sctp@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
	Tomas Bortoli <tomasbortoli@gmail.com>
Subject: Re: [PATCH] sctp: socket.c validate sprstat_policy
Date: Sun, 28 Oct 2018 04:50:55 +0800	[thread overview]
Message-ID: <201810280407.iHHCf3ff%fengguang.wu@intel.com> (raw)
In-Reply-To: <20181027195853.30243-1-tomasbortoli@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4456 bytes --]

Hi Tomas,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.19 next-20181019]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Tomas-Bortoli/sctp-socket-c-validate-sprstat_policy/20181028-040051
config: i386-randconfig-x075-201843 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/atomic.h:5:0,
                    from include/linux/atomic.h:7,
                    from include/linux/crypto.h:20,
                    from include/crypto/hash.h:16,
                    from net/sctp/socket.c:55:
   net/sctp/socket.c: In function 'sctp_getsockopt_pr_assocstatus':
   net/sctp/socket.c:7086:25: error: called object is not a function or function pointer
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> net/sctp/socket.c:7086:2: note: in expansion of macro 'if'
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
     ^~
   net/sctp/socket.c:7086:25: error: called object is not a function or function pointer
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> net/sctp/socket.c:7086:2: note: in expansion of macro 'if'
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
     ^~
   net/sctp/socket.c:7086:25: error: called object is not a function or function pointer
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> net/sctp/socket.c:7086:2: note: in expansion of macro 'if'
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
     ^~

vim +/if +7086 net/sctp/socket.c

  7066	
  7067	static int sctp_getsockopt_pr_assocstatus(struct sock *sk, int len,
  7068						  char __user *optval,
  7069						  int __user *optlen)
  7070	{
  7071		struct sctp_prstatus params;
  7072		struct sctp_association *asoc;
  7073		int policy;
  7074		int retval = -EINVAL;
  7075	
  7076		if (len < sizeof(params))
  7077			goto out;
  7078	
  7079		len = sizeof(params);
  7080		if (copy_from_user(&params, optval, len)) {
  7081			retval = -EFAULT;
  7082			goto out;
  7083		}
  7084	
  7085		policy = params.sprstat_policy;
> 7086		if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
  7087		    __SCTP_PR_INDEX(policy) > SCTP_PR_INDEX(MAX))
  7088			goto out;
  7089	
  7090		asoc = sctp_id2assoc(sk, params.sprstat_assoc_id);
  7091		if (!asoc)
  7092			goto out;
  7093	
  7094		if (policy & SCTP_PR_SCTP_ALL) {
  7095			params.sprstat_abandoned_unsent = 0;
  7096			params.sprstat_abandoned_sent = 0;
  7097			for (policy = 0; policy <= SCTP_PR_INDEX(MAX); policy++) {
  7098				params.sprstat_abandoned_unsent +=
  7099					asoc->abandoned_unsent[policy];
  7100				params.sprstat_abandoned_sent +=
  7101					asoc->abandoned_sent[policy];
  7102			}
  7103		} else {
  7104			params.sprstat_abandoned_unsent =
  7105				asoc->abandoned_unsent[__SCTP_PR_INDEX(policy)];
  7106			params.sprstat_abandoned_sent =
  7107				asoc->abandoned_sent[__SCTP_PR_INDEX(policy)];
  7108		}
  7109	
  7110		if (put_user(len, optlen)) {
  7111			retval = -EFAULT;
  7112			goto out;
  7113		}
  7114	
  7115		if (copy_to_user(optval, &params, len)) {
  7116			retval = -EFAULT;
  7117			goto out;
  7118		}
  7119	
  7120		retval = 0;
  7121	
  7122	out:
  7123		return retval;
  7124	}
  7125	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33915 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: linux-sctp@vger.kernel.org
Subject: Re: [PATCH] sctp: socket.c validate sprstat_policy
Date: Sat, 27 Oct 2018 20:50:55 +0000	[thread overview]
Message-ID: <201810280407.iHHCf3ff%fengguang.wu@intel.com> (raw)
In-Reply-To: <20181027195853.30243-1-tomasbortoli@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4456 bytes --]

Hi Tomas,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]
[also build test WARNING on v4.19 next-20181019]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Tomas-Bortoli/sctp-socket-c-validate-sprstat_policy/20181028-040051
config: i386-randconfig-x075-201843 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/atomic.h:5:0,
                    from include/linux/atomic.h:7,
                    from include/linux/crypto.h:20,
                    from include/crypto/hash.h:16,
                    from net/sctp/socket.c:55:
   net/sctp/socket.c: In function 'sctp_getsockopt_pr_assocstatus':
   net/sctp/socket.c:7086:25: error: called object is not a function or function pointer
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> net/sctp/socket.c:7086:2: note: in expansion of macro 'if'
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
     ^~
   net/sctp/socket.c:7086:25: error: called object is not a function or function pointer
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> net/sctp/socket.c:7086:2: note: in expansion of macro 'if'
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
     ^~
   net/sctp/socket.c:7086:25: error: called object is not a function or function pointer
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> net/sctp/socket.c:7086:2: note: in expansion of macro 'if'
     if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
     ^~

vim +/if +7086 net/sctp/socket.c

  7066	
  7067	static int sctp_getsockopt_pr_assocstatus(struct sock *sk, int len,
  7068						  char __user *optval,
  7069						  int __user *optlen)
  7070	{
  7071		struct sctp_prstatus params;
  7072		struct sctp_association *asoc;
  7073		int policy;
  7074		int retval = -EINVAL;
  7075	
  7076		if (len < sizeof(params))
  7077			goto out;
  7078	
  7079		len = sizeof(params);
  7080		if (copy_from_user(&params, optval, len)) {
  7081			retval = -EFAULT;
  7082			goto out;
  7083		}
  7084	
  7085		policy = params.sprstat_policy;
> 7086		if (!policy || (policy & ~(SCTP_PR_SCTP_MASK | SCTP_PR_SCTP_ALL))
  7087		    __SCTP_PR_INDEX(policy) > SCTP_PR_INDEX(MAX))
  7088			goto out;
  7089	
  7090		asoc = sctp_id2assoc(sk, params.sprstat_assoc_id);
  7091		if (!asoc)
  7092			goto out;
  7093	
  7094		if (policy & SCTP_PR_SCTP_ALL) {
  7095			params.sprstat_abandoned_unsent = 0;
  7096			params.sprstat_abandoned_sent = 0;
  7097			for (policy = 0; policy <= SCTP_PR_INDEX(MAX); policy++) {
  7098				params.sprstat_abandoned_unsent +=
  7099					asoc->abandoned_unsent[policy];
  7100				params.sprstat_abandoned_sent +=
  7101					asoc->abandoned_sent[policy];
  7102			}
  7103		} else {
  7104			params.sprstat_abandoned_unsent =
  7105				asoc->abandoned_unsent[__SCTP_PR_INDEX(policy)];
  7106			params.sprstat_abandoned_sent =
  7107				asoc->abandoned_sent[__SCTP_PR_INDEX(policy)];
  7108		}
  7109	
  7110		if (put_user(len, optlen)) {
  7111			retval = -EFAULT;
  7112			goto out;
  7113		}
  7114	
  7115		if (copy_to_user(optval, &params, len)) {
  7116			retval = -EFAULT;
  7117			goto out;
  7118		}
  7119	
  7120		retval = 0;
  7121	
  7122	out:
  7123		return retval;
  7124	}
  7125	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33915 bytes --]

  reply	other threads:[~2018-10-27 22:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27 19:58 [PATCH] sctp: socket.c validate sprstat_policy Tomas Bortoli
2018-10-27 19:58 ` Tomas Bortoli
2018-10-27 20:50 ` kbuild test robot [this message]
2018-10-27 20:50   ` kbuild test robot
2018-10-27 20:53 ` kbuild test robot
2018-10-27 20:53   ` kbuild test robot
2018-10-27 20:20 Tomas Bortoli
2018-10-27 20:20 ` Tomas Bortoli
2018-10-27 20:43 ` Tomas Bortoli
2018-10-27 20:43   ` Tomas Bortoli
2018-10-28  0:03   ` David Miller
2018-10-28  0:03     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201810280407.iHHCf3ff%fengguang.wu@intel.com \
    --to=lkp@intel.com \
    --cc=davem@davemloft.net \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=syzkaller@googlegroups.com \
    --cc=tomasbortoli@gmail.com \
    --cc=vyasevich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.