Re: [PATCH v4] sco:Add support for BT_PKT_STATUS CMSG data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alain,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20200611]
[cannot apply to bluetooth/master v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Alain-Michaud/sco-Add-support-for-BT_PKT_STATUS-CMSG-data/20200610-223512
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: sh-randconfig-s032-20200611 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-250-g42323db3-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=sh CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

   net/bluetooth/sco.c:826:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int const *__gu_addr @@     got unsigned int [noderef] [usertype] <asn:1> * @@
   net/bluetooth/sco.c:826:21: sparse:     expected unsigned int const *__gu_addr
   net/bluetooth/sco.c:826:21: sparse:     got unsigned int [noderef] [usertype] <asn:1> *
   net/bluetooth/sco.c:826:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] <asn:1> * @@     got unsigned int const *__gu_addr @@
   net/bluetooth/sco.c:826:21: sparse:     expected void const volatile [noderef] <asn:1> *
   net/bluetooth/sco.c:826:21: sparse:     got unsigned int const *__gu_addr
>> net/bluetooth/sco.c:863:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] <asn:1> * @@
   net/bluetooth/sco.c:863:21: sparse:     expected int const *__gu_addr
>> net/bluetooth/sco.c:863:21: sparse:     got int [noderef] <asn:1> *
   net/bluetooth/sco.c:863:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] <asn:1> * @@     got int const *__gu_addr @@
   net/bluetooth/sco.c:863:21: sparse:     expected void const volatile [noderef] <asn:1> *
   net/bluetooth/sco.c:863:21: sparse:     got int const *__gu_addr
   net/bluetooth/sco.c:893:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] <asn:1> *optlen @@
   net/bluetooth/sco.c:893:13: sparse:     expected int const *__gu_addr
   net/bluetooth/sco.c:893:13: sparse:     got int [noderef] <asn:1> *optlen
   net/bluetooth/sco.c:893:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] <asn:1> * @@     got int const *__gu_addr @@
   net/bluetooth/sco.c:893:13: sparse:     expected void const volatile [noderef] <asn:1> *
   net/bluetooth/sco.c:893:13: sparse:     got int const *__gu_addr
   net/bluetooth/sco.c:958:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int const *__gu_addr @@     got int [noderef] <asn:1> *optlen @@
   net/bluetooth/sco.c:958:13: sparse:     expected int const *__gu_addr
   net/bluetooth/sco.c:958:13: sparse:     got int [noderef] <asn:1> *optlen
   net/bluetooth/sco.c:958:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] <asn:1> * @@     got int const *__gu_addr @@
   net/bluetooth/sco.c:958:13: sparse:     expected void const volatile [noderef] <asn:1> *
   net/bluetooth/sco.c:958:13: sparse:     got int const *__gu_addr

vim +863 net/bluetooth/sco.c

   804	
   805	static int sco_sock_setsockopt(struct socket *sock, int level, int optname,
   806				       char __user *optval, unsigned int optlen)
   807	{
   808		struct sock *sk = sock->sk;
   809		int len, err = 0;
   810		struct bt_voice voice;
   811		u32 opt;
   812		int pkt_status;
   813	
   814		BT_DBG("sk %p", sk);
   815	
   816		lock_sock(sk);
   817	
   818		switch (optname) {
   819	
   820		case BT_DEFER_SETUP:
   821			if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) {
   822				err = -EINVAL;
   823				break;
   824			}
   825	
 > 826			if (get_user(opt, (u32 __user *) optval)) {
   827				err = -EFAULT;
   828				break;
   829			}
   830	
   831			if (opt)
   832				set_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags);
   833			else
   834				clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags);
   835			break;
   836	
   837		case BT_VOICE:
   838			if (sk->sk_state != BT_OPEN && sk->sk_state != BT_BOUND &&
   839			    sk->sk_state != BT_CONNECT2) {
   840				err = -EINVAL;
   841				break;
   842			}
   843	
   844			voice.setting = sco_pi(sk)->setting;
   845	
   846			len = min_t(unsigned int, sizeof(voice), optlen);
   847			if (copy_from_user((char *)&voice, optval, len)) {
   848				err = -EFAULT;
   849				break;
   850			}
   851	
   852			/* Explicitly check for these values */
   853			if (voice.setting != BT_VOICE_TRANSPARENT &&
   854			    voice.setting != BT_VOICE_CVSD_16BIT) {
   855				err = -EINVAL;
   856				break;
   857			}
   858	
   859			sco_pi(sk)->setting = voice.setting;
   860			break;
   861	
   862		case BT_PKT_STATUS:
 > 863			if (get_user(pkt_status, (int __user *)optval)) {
   864				err = -EFAULT;
   865				break;
   866			}
   867	
   868			if (pkt_status)
   869				set_bit(BT_CMSG_PKT_STATUS, &sco_pi(sk)->cmsg_mask);
   870			else
   871				clear_bit(BT_CMSG_PKT_STATUS, &sco_pi(sk)->cmsg_mask);
   872			break;
   873	
   874		default:
   875			err = -ENOPROTOOPT;
   876			break;
   877		}
   878	
   879		release_sock(sk);
   880		return err;
   881	}
   882	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux