Re: [PATCH] tty: Add MOXA NPort Real TTY Driver

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

 



Hi "Johnson,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on v5.8-rc6 next-20200723]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Johnson-CH-Chen/tty-Add-MOXA-NPort-Real-TTY-Driver/20200714-142712
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: mips-randconfig-s032-20200723 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-93-g4c6cbe55-dirty
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=mips 

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


sparse warnings: (new ones prefixed by >>)

   drivers/tty/npreal2.c:1107:26: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got struct serial_struct *retinfo @@
   drivers/tty/npreal2.c:1107:26: sparse:     expected void [noderef] __user *to
   drivers/tty/npreal2.c:1107:26: sparse:     got struct serial_struct *retinfo
   drivers/tty/npreal2.c:1122:56: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got struct serial_struct *new_info @@
   drivers/tty/npreal2.c:1122:56: sparse:     expected void const [noderef] __user *from
   drivers/tty/npreal2.c:1122:56: sparse:     got struct serial_struct *new_info
   drivers/tty/npreal2.c:1149:57: sparse: sparse: Using plain integer as NULL pointer
   drivers/tty/npreal2.c:1186:9: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int [noderef] __user *__pu_addr @@     got unsigned int *value @@
   drivers/tty/npreal2.c:1186:9: sparse:     expected unsigned int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:1186:9: sparse:     got unsigned int *value
   drivers/tty/npreal2.c:1624:38: sparse: sparse: Using plain integer as NULL pointer
   drivers/tty/npreal2.c:1897:34: sparse: sparse: Using plain integer as NULL pointer
   drivers/tty/npreal2.c:1914:21: sparse: sparse: Using plain integer as NULL pointer
   drivers/tty/npreal2.c:1984:46: sparse: sparse: Using plain integer as NULL pointer
   drivers/tty/npreal2.c:2261:17: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned long [noderef] __user *__pu_addr @@     got unsigned long * @@
   drivers/tty/npreal2.c:2261:17: sparse:     expected unsigned long [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2261:17: sparse:     got unsigned long *
>> drivers/tty/npreal2.c:2265:17: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned long const [noderef] __user *__gu_ptr @@     got unsigned long * @@
>> drivers/tty/npreal2.c:2265:17: sparse:     expected unsigned long const [noderef] __user *__gu_ptr
   drivers/tty/npreal2.c:2265:17: sparse:     got unsigned long *
   drivers/tty/npreal2.c:2319:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2319:21: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2319:21: sparse:     got int *
   drivers/tty/npreal2.c:2319:62: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2319:62: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2319:62: sparse:     got int *
   drivers/tty/npreal2.c:2320:25: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2320:25: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2320:25: sparse:     got int *
   drivers/tty/npreal2.c:2321:25: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2321:25: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2321:25: sparse:     got int *
   drivers/tty/npreal2.c:2322:25: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2322:25: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2322:25: sparse:     got int *
   drivers/tty/npreal2.c:2323:25: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2323:25: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2323:25: sparse:     got int *
   drivers/tty/npreal2.c:2324:25: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2324:25: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2324:25: sparse:     got int *
   drivers/tty/npreal2.c:2329:17: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2329:17: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2329:17: sparse:     got int *
   drivers/tty/npreal2.c:2330:17: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2330:17: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2330:17: sparse:     got int *
   drivers/tty/npreal2.c:2331:17: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2331:17: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2331:17: sparse:     got int *
   drivers/tty/npreal2.c:2332:17: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int [noderef] __user *__pu_addr @@     got int * @@
   drivers/tty/npreal2.c:2332:17: sparse:     expected int [noderef] __user *__pu_addr
   drivers/tty/npreal2.c:2332:17: sparse:     got int *
   drivers/tty/npreal2.c:2570:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got void * @@
   drivers/tty/npreal2.c:2570:35: sparse:     expected void [noderef] __user *to
   drivers/tty/npreal2.c:2570:35: sparse:     got void *
   drivers/tty/npreal2.c:2591:57: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void * @@
   drivers/tty/npreal2.c:2591:57: sparse:     expected void const [noderef] __user *from
   drivers/tty/npreal2.c:2591:57: sparse:     got void *
   drivers/tty/npreal2.c:2720:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got void * @@
   drivers/tty/npreal2.c:2720:35: sparse:     expected void [noderef] __user *to
   drivers/tty/npreal2.c:2720:35: sparse:     got void *
   drivers/tty/npreal2.c:2734:56: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void * @@
   drivers/tty/npreal2.c:2734:56: sparse:     expected void const [noderef] __user *from
   drivers/tty/npreal2.c:2734:56: sparse:     got void *
   drivers/tty/npreal2.c:2803:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got char *buf @@
   drivers/tty/npreal2.c:2803:34: sparse:     expected void [noderef] __user *to
   drivers/tty/npreal2.c:2803:34: sparse:     got char *buf
   drivers/tty/npreal2.c:2831:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got char * @@
   drivers/tty/npreal2.c:2831:38: sparse:     expected void [noderef] __user *to
   drivers/tty/npreal2.c:2831:38: sparse:     got char *
   drivers/tty/npreal2.c:2899:38: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got char const *buf @@
   drivers/tty/npreal2.c:2899:38: sparse:     expected void const [noderef] __user *from
   drivers/tty/npreal2.c:2899:38: sparse:     got char const *buf
>> drivers/tty/npreal2.c:2950:22: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *proc_read )( ... ) @@     got int ( * )( ... ) @@
>> drivers/tty/npreal2.c:2950:22: sparse:     expected int ( *proc_read )( ... )
>> drivers/tty/npreal2.c:2950:22: sparse:     got int ( * )( ... )
>> drivers/tty/npreal2.c:2951:23: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@     expected int ( *proc_write )( ... ) @@     got int ( * )( ... ) @@
>> drivers/tty/npreal2.c:2951:23: sparse:     expected int ( *proc_write )( ... )
   drivers/tty/npreal2.c:2951:23: sparse:     got int ( * )( ... )
   drivers/tty/npreal2.c:2954:22: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __poll_t ( *proc_poll )( ... ) @@     got unsigned int ( * )( ... ) @@
   drivers/tty/npreal2.c:2954:22: sparse:     expected restricted __poll_t ( *proc_poll )( ... )
   drivers/tty/npreal2.c:2954:22: sparse:     got unsigned int ( * )( ... )

vim +2265 drivers/tty/npreal2.c

  2201	
  2202	static int npreal_ioctl(struct tty_struct *tty, unsigned int cmd,
  2203				unsigned long arg)
  2204	{
  2205		struct npreal_struct *info = (struct npreal_struct *)tty->driver_data;
  2206		struct serial_icounter_struct *p_cuser; /* user space */
  2207		unsigned long templ;
  2208		int ret = 0;
  2209	
  2210		if (!info)
  2211			return -ENODEV;
  2212	
  2213		if ((cmd != TIOCGSERIAL) && (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT) &&
  2214			test_bit(TTY_IO_ERROR, &tty->flags))
  2215			return -EIO;
  2216	
  2217		switch (cmd) {
  2218		case TCFLSH:
  2219			ret = tty_check_change(tty);
  2220			if (!ret) {
  2221				switch (arg) {
  2222				case TCIFLUSH:
  2223					if (tty->ldisc->ops->flush_buffer)
  2224						tty->ldisc->ops->flush_buffer(tty);
  2225					break;
  2226	
  2227				case TCIOFLUSH:
  2228					if (tty->ldisc->ops->flush_buffer)
  2229						tty->ldisc->ops->flush_buffer(tty);
  2230					npreal_flush_buffer(tty);
  2231					break;
  2232	
  2233				case TCOFLUSH:
  2234					npreal_flush_buffer(tty);
  2235					break;
  2236	
  2237				default:
  2238					ret = -EINVAL;
  2239				}
  2240			}
  2241			break;
  2242	
  2243		case TCSBRK: /* SVID version: non-zero arg --> no break */
  2244			ret = tty_check_change(tty);
  2245			if (!ret) {
  2246				tty_wait_until_sent(tty, 0);
  2247				if (!arg)
  2248					npreal_send_break(info, HZ / 4);
  2249			}
  2250			break;
  2251	
  2252		case TCSBRKP: /* support for POSIX tcsendbreak() */
  2253			ret = tty_check_change(tty);
  2254			if (!ret) {
  2255				tty_wait_until_sent(tty, 0);
  2256				npreal_send_break(info, arg ? arg * (HZ / 10) : HZ / 4);
  2257			}
  2258			break;
  2259	
  2260		case TIOCGSOFTCAR:
  2261			put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *)arg);
  2262			break;
  2263	
  2264		case TIOCSSOFTCAR:
> 2265			get_user(templ, (unsigned long *)arg);
  2266			tty->termios.c_cflag = ((tty->termios.c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
  2267			break;
  2268	
  2269		case TIOCGSERIAL:
  2270			ret = (npreal_get_serial_info(info, (struct serial_struct *)arg));
  2271			break;
  2272	
  2273		case TIOCSSERIAL:
  2274			ret = (npreal_set_serial_info(info, (struct serial_struct *)arg));
  2275			break;
  2276	
  2277		case TIOCSERGETLSR: /* Get line status register */
  2278			ret = (npreal_get_lsr_info(info, (unsigned int *)arg));
  2279			break;
  2280	
  2281		case TIOCMIWAIT: {
  2282			struct async_icount cprev;
  2283			DECLARE_WAITQUEUE(wait, current);
  2284	
  2285			cprev = info->icount;
  2286			add_wait_queue(&info->delta_msr_wait, &wait);
  2287			while (1) {
  2288				struct async_icount cnow;
  2289	
  2290				cnow = info->icount;
  2291				if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
  2292					((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
  2293					((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
  2294					((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
  2295					ret = 0;
  2296					break;
  2297				}
  2298	
  2299				if (signal_pending(current)) {
  2300					ret = -ERESTARTSYS;
  2301					break;
  2302				}
  2303	
  2304				cprev = cnow;
  2305				current->state = TASK_INTERRUPTIBLE;
  2306				schedule();
  2307			}
  2308	
  2309			remove_wait_queue(&info->delta_msr_wait, &wait);
  2310			break;
  2311		}
  2312	
  2313		case TIOCGICOUNT:{
  2314			struct async_icount cnow;
  2315	
  2316			cnow = info->icount;
  2317			p_cuser = (struct serial_icounter_struct *)arg;
  2318	
  2319			if (put_user(cnow.frame, &p_cuser->frame) || put_user(cnow.brk, &p_cuser->brk) ||
  2320				put_user(cnow.overrun, &p_cuser->overrun) ||
  2321				put_user(cnow.buf_overrun, &p_cuser->buf_overrun) ||
  2322				put_user(cnow.parity, &p_cuser->parity) ||
  2323				put_user(cnow.rx, &p_cuser->rx) ||
  2324				put_user(cnow.tx, &p_cuser->tx)) {
  2325				ret = -EFAULT;
  2326				break;
  2327			}
  2328	
  2329			put_user(cnow.cts, &p_cuser->cts);
  2330			put_user(cnow.dsr, &p_cuser->dsr);
  2331			put_user(cnow.rng, &p_cuser->rng);
  2332			put_user(cnow.dcd, &p_cuser->dcd);
  2333			break;
  2334		}
  2335		case TCXONC:
  2336			ret = tty_check_change(tty);
  2337			if (!ret) {
  2338				switch (arg) {
  2339				case TCOOFF:
  2340					ret = npreal_set_generic_command_done(info, ASPP_CMD_SETXOFF);
  2341					break;
  2342	
  2343				case TCOON:
  2344					ret = npreal_set_generic_command_done(info, ASPP_CMD_SETXON);
  2345					break;
  2346	
  2347				default:
  2348					ret = -EINVAL;
  2349				}
  2350			}
  2351			break;
  2352	
  2353		default:
  2354			ret = -ENOIOCTLCMD;
  2355		}
  2356		return ret;
  2357	}
  2358	

---
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]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux