Re: [PATCH v2] tty: n_tty: use kvzalloc/kvfree for line discipline data

From: kernel test robot

Date: Fri Aug 21 2026 - 04:37:34 EST


Hi Xin,

kernel test robot noticed the following build errors:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on tty/tty-next tty/tty-linus linus/master v7.2 next-20260819]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Xin-Chen/tty-n_tty-use-kvzalloc-kvfree-for-line-discipline-data/20260818-150324
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
patch link: https://lore.kernel.org/r/20260818070324.136726-1-xin.chen2%40oss.qualcomm.com
patch subject: [PATCH v2] tty: n_tty: use kvzalloc/kvfree for line discipline data
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260821/202608211618.rZcRAXep-lkp@xxxxxxxxx/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260821/202608211618.rZcRAXep-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608211618.rZcRAXep-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> drivers/tty/n_tty.c:1890:8: error: incompatible pointer types assigning to 'struct n_tty_data *' from 'typeof (ldata) *' (aka 'struct n_tty_data **'); dereference with * [-Wincompatible-pointer-types]
1890 | ldata = kvzalloc_obj(ldata);
| ^ ~~~~~~~~~~~~~~~~~~~
| *( )
1 error generated.


vim +1890 drivers/tty/n_tty.c

1876
1877 /**
1878 * n_tty_open - open an ldisc
1879 * @tty: terminal to open
1880 *
1881 * Called when this line discipline is being attached to the terminal device.
1882 * Can sleep. Called serialized so that no other events will occur in parallel.
1883 * No further open will occur until a close.
1884 */
1885 static int n_tty_open(struct tty_struct *tty)
1886 {
1887 struct n_tty_data *ldata;
1888
1889 /* Currently a malloc failure here can panic */
> 1890 ldata = kvzalloc_obj(ldata);
1891 if (!ldata)
1892 return -ENOMEM;
1893
1894 ldata->overrun_time = jiffies;
1895 mutex_init(&ldata->atomic_read_lock);
1896 mutex_init(&ldata->output_lock);
1897
1898 tty->disc_data = ldata;
1899 tty->closing = 0;
1900 /* indicate buffer work may resume */
1901 clear_bit(TTY_LDISC_HALTED, &tty->flags);
1902 n_tty_set_termios(tty, NULL);
1903 tty_unthrottle(tty);
1904 return 0;
1905 }
1906

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki