Re: serial_core:recognize invalid pointer from userspace

From: kbuild test robot
Date: Wed Mar 09 2016 - 03:24:57 EST


Hi Jiang,

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on v4.5-rc7 next-20160309]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url: https://github.com/0day-ci/linux/commits/Jiang-Lu/serial_core-recognize-invalid-pointer-from-userspace/20160309-160641
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: i386-randconfig-x000-201610 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

drivers/tty/serial/serial_core.c: In function 'uart_set_info':
>> drivers/tty/serial/serial_core.c:750:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
new_info->iomem_base = (unsigned char *)uport->mapbase;
^

vim +750 drivers/tty/serial/serial_core.c

734 new_info->irq = irq_canonicalize(new_info->irq);
735 close_delay = msecs_to_jiffies(new_info->close_delay * 10);
736 closing_wait = new_info->closing_wait == ASYNC_CLOSING_WAIT_NONE ?
737 ASYNC_CLOSING_WAIT_NONE :
738 msecs_to_jiffies(new_info->closing_wait * 10);
739
740
741 change_irq = !(uport->flags & UPF_FIXED_PORT)
742 && new_info->irq != uport->irq;
743
744 /*
745 * Since changing the 'type' of the port changes its resource
746 * allocations, we should treat type changes the same as
747 * IO port changes.
748 */
749 if ((unsigned long)new_info->iomem_base == 0xffffffff)
> 750 new_info->iomem_base = (unsigned char *)uport->mapbase;
751
752 change_port = !(uport->flags & UPF_FIXED_PORT)
753 && (new_port != uport->iobase ||
754 (unsigned long)new_info->iomem_base != uport->mapbase ||
755 new_info->hub6 != uport->hub6 ||
756 new_info->io_type != uport->iotype ||
757 new_info->iomem_reg_shift != uport->regshift ||
758 new_info->type != uport->type);

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

Attachment: .config.gz
Description: Binary data