1. 08 Aug, 2018 8 commits
    • Mauro Carvalho Chehab's avatar
      media: xc4000: get rid of uneeded casts · 8218840f
      Mauro Carvalho Chehab authored
      Instead of doing casts, use %zd to print sizes, in order to make
      smatch happier:
      	drivers/media/tuners/xc4000.c:818 xc4000_fwupload() warn: argument 4 to %d specifier is cast from pointer
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      8218840f
    • Mauro Carvalho Chehab's avatar
      media: drxj: get rid of uneeded casts · c4f04796
      Mauro Carvalho Chehab authored
      Instead of doing casts, use %zd to print sizes, in order to make
      smatch happier:
      	drivers/media/dvb-frontends/drx39xyj/drxj.c:11814 drx_ctrl_u_code() warn: argument 4 to %u specifier is cast from pointer
      	drivers/media/dvb-frontends/drx39xyj/drxj.c:11845 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer
      	drivers/media/dvb-frontends/drx39xyj/drxj.c:11869 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer
      	drivers/media/dvb-frontends/drx39xyj/drxj.c:11878 drx_ctrl_u_code() warn: argument 3 to %u specifier is cast from pointer
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      c4f04796
    • Mauro Carvalho Chehab's avatar
      media: tuner-xc2028: don't use casts for printing sizes · 3fcb3c83
      Mauro Carvalho Chehab authored
      Makes smatch happier by using %zd instead of casting sizes:
      	drivers/media/tuners/tuner-xc2028.c:378 load_all_firmwares() warn: argument 4 to %d specifier is cast from pointer
      	drivers/media/tuners/tuner-xc2028.c:619 load_firmware() warn: argument 6 to %d specifier is cast from pointer
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      3fcb3c83
    • Mauro Carvalho Chehab's avatar
      media: cleanup fall-through comments · 40e43111
      Mauro Carvalho Chehab authored
      As Ian pointed out, adding a '-' to the fallthrough seems to meet
      the regex requirements at level 3 of the warning, at least when
      the comment fits into a single line.
      
      So, replace by a single line the comments that were broken into
      multiple lines just to make gcc -Wimplicit-fallthrough=3 happy.
      Suggested-by: default avatarIan Arkver <ian.arkver.dev@gmail.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      40e43111
    • Mauro Carvalho Chehab's avatar
      media: vivid: shut up warnings due to a non-trivial logic · 3354b54f
      Mauro Carvalho Chehab authored
      The vivid driver uses a complex logic to save one kalloc/kfree
      allocation. That non-trivial way of allocating data causes
      smatch to warn:
      	drivers/media/platform/vivid/vivid-core.c:869 vivid_create_instance() warn: potentially one past the end of array 'dev->query_dv_timings_qmenu[dev->query_dv_timings_size]'
      	drivers/media/platform/vivid/vivid-core.c:869 vivid_create_instance() warn: potentially one past the end of array 'dev->query_dv_timings_qmenu[dev->query_dv_timings_size]'
      
      I also needed to read the code several times in order to understand
      what it was desired there. It turns that the logic was right,
      although confusing to read.
      
      As it is doing allocations on a non-standard way, let's add some
      documentation while shutting up the false positive.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      3354b54f
    • Mauro Carvalho Chehab's avatar
      media: rtl28xxu: be sure that it won't go past the array size · 845b978a
      Mauro Carvalho Chehab authored
      smatch warns that the RC query code could go past the array size:
      
      	drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1757 rtl2832u_rc_query() error: buffer overflow 'buf' 128 <= 130
      	drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1758 rtl2832u_rc_query() error: buffer overflow 'buf' 128 <= 130
      
      The driver logic gets the length of the IR RX buffer with:
      
              ret = rtl28xxu_rd_reg(d, IR_RX_BC, &buf[0]);
      	...
              len = buf[0];
      
      In thesis, this could range between 0 and 255 [1].
      
      While this should never happen in practice, due to hardware limits,
      smatch is right when it complains about that, as there's nothing at
      the logic that would prevent it. So, if for whatever reason, buf[0]
      gets filled by rtl28xx read functions with a value bigger than 128,
      it will go past the array.
      
      So, add an explicit check.
      
      [1] I've no idea why smatch thinks that the maximum value is 130.
      I double-checked the code several times. Was unable to find any
      reason for assuming 130. Perhaps smatch is not properly parsing
      u8 here?
      
      Fixes: b5cbaa43 ("[media] rtl28xx: initial support for rtl2832u")
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      845b978a
    • Mauro Carvalho Chehab's avatar
      media: mt9v111: avoid going past the buffer · d9a71866
      Mauro Carvalho Chehab authored
      As warned by smatch:
      	drivers/media/i2c/mt9v111.c:854 mt9v111_enum_frame_size() error: buffer overflow 'mt9v111_frame_sizes' 5 <= 5
      	drivers/media/i2c/mt9v111.c:855 mt9v111_enum_frame_size() error: buffer overflow 'mt9v111_frame_sizes' 5 <= 5
      	drivers/media/i2c/mt9v111.c:856 mt9v111_enum_frame_size() error: buffer overflow 'mt9v111_frame_sizes' 5 <= 5
      	drivers/media/i2c/mt9v111.c:857 mt9v111_enum_frame_size() error: buffer overflow 'mt9v111_frame_sizes' 5 <= 5
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      d9a71866
    • Mauro Carvalho Chehab's avatar
      media: vsp1_dl: add a description for cmdpool field · 75070c6a
      Mauro Carvalho Chehab authored
      Gets rid of this build warning:
      	drivers/media/platform/vsp1/vsp1_dl.c:229: warning: Function parameter or member 'cmdpool' not described in 'vsp1_dl_manager'
      
      Fixes: f3b98e3c ("media: vsp1: Provide support for extended command pools")
      Reviewed-by: default avatarKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      75070c6a
  2. 07 Aug, 2018 4 commits
  3. 03 Aug, 2018 23 commits
  4. 02 Aug, 2018 5 commits