lkml.org 
[lkml]   [2021]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 09/24] wfx: add hwio.c/hwio.h
    On Tue, Dec 22, 2020 at 10:02:09PM +0100, Jérôme Pouiller wrote:
    > On Tuesday 22 December 2020 16:27:01 CET Greg Kroah-Hartman wrote:
    > >
    > > On Tue, Dec 22, 2020 at 05:10:11PM +0200, Kalle Valo wrote:
    > > > Jerome Pouiller <Jerome.Pouiller@silabs.com> writes:
    > > >
    > > > > +/*
    > > > > + * Internal helpers.
    > > > > + *
    > > > > + * About CONFIG_VMAP_STACK:
    > > > > + * When CONFIG_VMAP_STACK is enabled, it is not possible to run DMA on stack
    > > > > + * allocated data. Functions below that work with registers (aka functions
    > > > > + * ending with "32") automatically reallocate buffers with kmalloc. However,
    > > > > + * functions that work with arbitrary length buffers let's caller to handle
    > > > > + * memory location. In doubt, enable CONFIG_DEBUG_SG to detect badly located
    > > > > + * buffer.
    > > > > + */
    > > >
    > > > This sounds very hacky to me, I have understood that you should never
    > > > use stack with DMA.
    > >
    > > You should never do that because some platforms do not support it, so no
    > > driver should ever try to do that as they do not know what platform they
    > > are running on.
    >
    > Yes, I have learned this rule the hard way.
    >
    > There is no better way than a comment to warn the user that the argument
    > will be used with a DMA? A Sparse annotation, for example?
    >

    There is a Smatch warning for this, but I hadn't looked at the results
    in a while. :/ I'm not sure how many are valid. Some kind of
    annotation would be nice.

    regards,
    dan carpenter

    drivers/staging/gdm724x/gdm_usb.c:69 request_mac_address() error: doing dma on the stack (buf)
    drivers/staging/rtl8192u/r8192U_core.c:1553 rtl8192_tx() error: doing dma on the stack (&zero)
    drivers/staging/comedi/drivers/dt9812.c:249 dt9812_read_info() error: doing dma on the stack (&cmd)
    drivers/staging/comedi/drivers/dt9812.c:273 dt9812_read_multiple_registers() error: doing dma on the stack (&cmd)
    drivers/staging/comedi/drivers/dt9812.c:299 dt9812_write_multiple_registers() error: doing dma on the stack (&cmd)
    drivers/staging/comedi/drivers/dt9812.c:318 dt9812_rmw_multiple_registers() error: doing dma on the stack (&cmd)
    drivers/staging/comedi/drivers/dt9812.c:330 dt9812_digital_in() error: doing dma on the stack (value)
    drivers/staging/comedi/drivers/dt9812.c:456 dt9812_analog_in() error: doing dma on the stack (val)
    drivers/staging/comedi/drivers/dt9812.c:692 dt9812_reset_device() error: doing dma on the stack (&tmp8)
    drivers/staging/comedi/drivers/dt9812.c:700 dt9812_reset_device() error: doing dma on the stack (&tmp8)
    drivers/staging/comedi/drivers/dt9812.c:711 dt9812_reset_device() error: doing dma on the stack (&tmp16)
    drivers/staging/comedi/drivers/dt9812.c:718 dt9812_reset_device() error: doing dma on the stack (&tmp16)
    drivers/staging/comedi/drivers/dt9812.c:725 dt9812_reset_device() error: doing dma on the stack (&tmp16)
    drivers/staging/comedi/drivers/dt9812.c:732 dt9812_reset_device() error: doing dma on the stack (&tmp32)
    drivers/usb/storage/alauda.c:498 alauda_check_status2() error: doing dma on the stack (command)
    drivers/usb/storage/alauda.c:503 alauda_check_status2() error: doing dma on the stack (data)
    drivers/usb/storage/alauda.c:527 alauda_get_redu_data() error: doing dma on the stack (command)
    drivers/usb/storage/alauda.c:702 alauda_erase_block() error: doing dma on the stack (command)
    drivers/usb/storage/alauda.c:707 alauda_erase_block() error: doing dma on the stack (buf)
    drivers/usb/storage/alauda.c:731 alauda_read_block_raw() error: doing dma on the stack (command)
    drivers/usb/storage/alauda.c:782 alauda_write_block() error: doing dma on the stack (command)
    drivers/usb/class/usblp.c:593 usblp_ioctl() error: doing dma on the stack (&newChannel)
    drivers/usb/serial/iuu_phoenix.c:542 iuu_uart_flush() error: doing dma on the stack (&rxcmd)
    drivers/firewire/core-device.c:565 read_config_rom() error: doing dma on the stack (&dummy)
    drivers/firewire/core-device.c:1111 reread_config_rom() error: doing dma on the stack (&q)
    drivers/media/usb/uvc/uvc_v4l2.c:910 uvc_ioctl_g_input() error: doing dma on the stack (&i)
    drivers/media/usb/uvc/uvc_v4l2.c:942 uvc_ioctl_s_input() error: doing dma on the stack (&i)
    drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c:662 initialize_cx231xx() error: doing dma on the stack (data)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:90 uninitGPIO() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:1297 cx231xx_enable_i2c_port_3() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:1313 cx231xx_enable_i2c_port_3() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:1546 cx231xx_set_Colibri_For_LowIF() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2261 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2278 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2288 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2297 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2311 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2321 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2332 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2342 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2353 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2376 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2386 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2396 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2407 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2417 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2446 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2457 cx231xx_set_power_mode() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2469 cx231xx_power_suspend() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2481 cx231xx_power_suspend() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2497 cx231xx_start_stream() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2509 cx231xx_start_stream() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2523 cx231xx_stop_stream() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2534 cx231xx_stop_stream() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2591 cx231xx_initialize_stream_xfer() error: doing dma on the stack (val)
    drivers/media/usb/cx231xx/cx231xx-avcore.c:2599 cx231xx_initialize_stream_xfer() error: doing dma on the stack (val)
    drivers/media/usb/cx231xx/cx231xx-core.c:635 cx231xx_demod_reset() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-core.c:644 cx231xx_demod_reset() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-core.c:649 cx231xx_demod_reset() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-core.c:654 cx231xx_demod_reset() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-core.c:658 cx231xx_demod_reset() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-core.c:1253 cx231xx_stop_TS1() error: doing dma on the stack (val)
    drivers/media/usb/cx231xx/cx231xx-core.c:1260 cx231xx_stop_TS1() error: doing dma on the stack (val)
    drivers/media/usb/cx231xx/cx231xx-core.c:1272 cx231xx_start_TS1() error: doing dma on the stack (val)
    drivers/media/usb/cx231xx/cx231xx-core.c:1279 cx231xx_start_TS1() error: doing dma on the stack (val)
    drivers/media/usb/cx231xx/cx231xx-core.c:1533 cx231xx_mode_register() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-core.c:1546 cx231xx_mode_register() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-video.c:1236 cx231xx_g_register() error: doing dma on the stack (value)
    drivers/media/usb/cx231xx/cx231xx-video.c:1297 cx231xx_s_register() error: doing dma on the stack (data)
    drivers/media/usb/gspca/kinect.c:209 write_register() error: doing dma on the stack (reply)
    drivers/net/usb/rndis_host.c:129 rndis_command() error: doing dma on the stack (&notification)

    \
     
     \ /
      Last update: 2021-01-04 13:36    [W:2.317 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site