[kbuild] drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 dc_stream_set_cursor_position() warn: variable dereferenced before check 'stream' (see line 392)

2022-10-27 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   4dc12f37a8e98e1dca5521c14625c869537b50b6
commit: a141d2083b462505727e14d98db5fc3cd43d59c6 drm/amd/display: Add debug 
option for exiting idle optimizations on cursor updates
config: mips-randconfig-m031-20221018
compiler: mips64el-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:395 
dc_stream_set_cursor_position() warn: variable dereferenced before check 
'stream' (see line 392)

vim +/stream +395 drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c

ab2541b6739508 Aric Cyr2016-12-29  388  bool 
dc_stream_set_cursor_position(
0971c40e180696 Harry Wentland  2017-07-27  389  struct dc_stream_state 
*stream,
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  390  const struct 
dc_cursor_position *position)
ab2541b6739508 Aric Cyr2016-12-29  391  {
a141d2083b4625 Alvin Lee   2022-06-03 @392  struct dc  *dc = 
stream->ctx->dc;
 

New unchecked dereference

4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  393  bool 
reset_idle_optimizations = false;
ab2541b6739508 Aric Cyr2016-12-29  394  
4fa086b9b66408 Leo (Sunpeng  Li2017-07-25 @395) if (NULL == stream) {
^^
Old Yoda code check for NULL

ab2541b6739508 Aric Cyr2016-12-29  396  dm_error("DC: 
dc_stream is NULL!\n");
ab2541b6739508 Aric Cyr2016-12-29  397  return false;
ab2541b6739508 Aric Cyr2016-12-29  398  }
ab2541b6739508 Aric Cyr2016-12-29  399  
ab2541b6739508 Aric Cyr2016-12-29  400  if (NULL == position) {
ab2541b6739508 Aric Cyr2016-12-29  401  dm_error("DC: 
cursor position is NULL!\n");
ab2541b6739508 Aric Cyr2016-12-29  402  return false;
ab2541b6739508 Aric Cyr2016-12-29  403  }
ab2541b6739508 Aric Cyr2016-12-29  404  
2b77dcc5e5aa38 Anthony Koo 2019-11-05  405  dc = stream->ctx->dc;
bae1f0b8a5b189 Nicholas Kazlauskas 2021-05-19  406  dc_z10_restore(dc);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  407  
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  408  /* disable idle 
optimizations if enabling cursor */
a141d2083b4625 Alvin Lee   2022-06-03  409  if 
(dc->idle_optimizations_allowed && (!stream->cursor_position.enable || 
dc->debug.exit_idle_opt_for_cursor_updates)
a141d2083b4625 Alvin Lee   2022-06-03  410  && 
position->enable) {
4b675aad969507 Joshua Aberback 2020-08-31  411  
dc_allow_idle_optimizations(dc, false);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  412  
reset_idle_optimizations = true;
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  413  }
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  414  
33fd17d9125c00 Eric Yang   2018-01-18  415  stream->cursor_position 
= *position;
ab2541b6739508 Aric Cyr2016-12-29  416  
4fd771ea441ed9 Roy Chan2021-07-19  417  
program_cursor_position(dc, stream, position);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  418  /* re-enable idle 
optimizations if necessary */
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  419  if 
(reset_idle_optimizations)
4b675aad969507 Joshua Aberback 2020-08-31  420  
dc_allow_idle_optimizations(dc, true);
4d55b0dd1cdd85 Bhawanpreet Lakha   2020-05-21  421  
beb16b6a0f921f Dmytro Laktyushkin  2017-04-21  422  return true;
ab2541b6739508 Aric Cyr2016-12-29  423  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH for-next] RDMA/rxe: rxe_get_av always receives ahp hence no put is needed

2022-10-26 Thread Dan Carpenter
Hi Md,

https://git-scm.com/docs/git-format-patch#_base_tree_information  ]

url:
https://github.com/intel-lab-lkp/linux/commits/Md-Haris-Iqbal/RDMA-rxe-rxe_get_av-always-receives-ahp-hence-no-put-is-needed/20221020-231859
  
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git   for-next
patch link:
https://lore.kernel.org/r/20221020151345.412731-1-haris.phnx%40gmail.com  
patch subject: [PATCH for-next] RDMA/rxe: rxe_get_av always receives ahp hence 
no put is needed
config: openrisc-randconfig-m041-20221024
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

smatch warnings:
drivers/infiniband/sw/rxe/rxe_av.c:133 rxe_get_av() error: we previously 
assumed 'ahp' could be null (see line 107)

vim +/ahp +133 drivers/infiniband/sw/rxe/rxe_av.c

63221acb0c6314 Bob Pearson 2022-03-03  102  struct rxe_av *rxe_get_av(struct 
rxe_pkt_info *pkt, struct rxe_ah **ahp)
8700e3e7c4857d Moni Shoua  2016-06-16  103  {
e2fe06c9080694 Bob Pearson 2021-10-07  104  struct rxe_ah *ah;
e2fe06c9080694 Bob Pearson 2021-10-07  105  u32 ah_num;
e2fe06c9080694 Bob Pearson 2021-10-07  106  
63221acb0c6314 Bob Pearson 2022-03-03 @107  if (ahp)
^^^
Check for NULL.  Maybe this check can be deleted.  It's never NULL in
the current code.

63221acb0c6314 Bob Pearson 2022-03-03  108  *ahp = NULL;
63221acb0c6314 Bob Pearson 2022-03-03  109  
8700e3e7c4857d Moni Shoua  2016-06-16  110  if (!pkt || !pkt->qp)
8700e3e7c4857d Moni Shoua  2016-06-16  111  return NULL;
8700e3e7c4857d Moni Shoua  2016-06-16  112  
8700e3e7c4857d Moni Shoua  2016-06-16  113  if (qp_type(pkt->qp) == 
IB_QPT_RC || qp_type(pkt->qp) == IB_QPT_UC)
8700e3e7c4857d Moni Shoua  2016-06-16  114  return >qp->pri_av;
8700e3e7c4857d Moni Shoua  2016-06-16  115  
e2fe06c9080694 Bob Pearson 2021-10-07  116  if (!pkt->wqe)
e2fe06c9080694 Bob Pearson 2021-10-07  117  return NULL;
e2fe06c9080694 Bob Pearson 2021-10-07  118  
e2fe06c9080694 Bob Pearson 2021-10-07  119  ah_num = 
pkt->wqe->wr.wr.ud.ah_num;
e2fe06c9080694 Bob Pearson 2021-10-07  120  if (ah_num) {
^^
Perhaps it is a false positive if checking "ah_num" is intended to be
equivalent to checking "ahp"?

e2fe06c9080694 Bob Pearson 2021-10-07  121  /* only new user 
provider or kernel client */
e2fe06c9080694 Bob Pearson 2021-10-07  122  ah = 
rxe_pool_get_index(>rxe->ah_pool, ah_num);
63221acb0c6314 Bob Pearson 2022-03-03  123  if (!ah) {
e2fe06c9080694 Bob Pearson 2021-10-07  124  pr_warn("Unable 
to find AH matching ah_num\n");
e2fe06c9080694 Bob Pearson 2021-10-07  125  return NULL;
e2fe06c9080694 Bob Pearson 2021-10-07  126  }
63221acb0c6314 Bob Pearson 2022-03-03  127  
63221acb0c6314 Bob Pearson 2022-03-03  128  if (rxe_ah_pd(ah) != 
pkt->qp->pd) {
63221acb0c6314 Bob Pearson 2022-03-03  129  pr_warn("PDs 
don't match for AH and QP\n");
3197706abd0532 Bob Pearson 2022-03-03  130  rxe_put(ah);
63221acb0c6314 Bob Pearson 2022-03-03  131  return NULL;
63221acb0c6314 Bob Pearson 2022-03-03  132  }
63221acb0c6314 Bob Pearson 2022-03-03 @133  *ahp = ah;

Unchecked dereference.

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp  
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] [jgunthorpe:vfio_iommufd 9/11] drivers/vfio/vfio_main.c:1690 vfio_file_enforced_coherent() warn: assigning (-95) to unsigned variable 'ret'

2022-10-25 Thread Dan Carpenter
tree:   https://github.com/jgunthorpe/linux vfio_iommufd
head:   a249441ba6fd9d658f4a1b568453e3a742d12686
commit: e44299750e287f3d64d207a5af7abb021634a31b [9/11] vfio: Make 
vfio_container optionally compiled
config: openrisc-randconfig-m041-20221024
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

New smatch warnings:
drivers/vfio/vfio_main.c:1690 vfio_file_enforced_coherent() warn: assigning 
(-95) to unsigned variable 'ret'

Old smatch warnings:
drivers/vfio/vfio_main.c:1907 vfio_pin_pages() warn: impossible condition 
'(iova > (~0)) => (0-u32max > u32max)'
drivers/vfio/vfio_main.c:1974 vfio_dma_rw() warn: impossible condition '(iova > 
(~0)) => (0-u32max > u32max)'

vim +/ret +1690 drivers/vfio/vfio_main.c

a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1671  /**
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1672   * 
vfio_file_enforced_coherent - True if the DMA associated with the VFIO file
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1673   *
is always CPU cache coherent

This comment sort of feels like returning false on error is the correct
thing but in the rest of the code it seems like returning true on error
is correct.

a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1674   * 
@file: VFIO group file
c0560f51cf7747 drivers/vfio/vfio.c  Yan Zhao2020-03-24  1675   *
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1676   * 
Enforced coherency means that the IOMMU ignores things like the PCIe no-snoop
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1677   * 
bit in DMA transactions. A return of false indicates that the user has
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1678   * 
rights to access additional instructions such as wbinvd on x86.
c0560f51cf7747 drivers/vfio/vfio.c  Yan Zhao2020-03-24  1679   */
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1680  bool 
vfio_file_enforced_coherent(struct file *file)
c0560f51cf7747 drivers/vfio/vfio.c  Yan Zhao2020-03-24  1681  {
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1682
struct vfio_group *group = file->private_data;
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1683
bool ret;
c0560f51cf7747 drivers/vfio/vfio.c  Yan Zhao2020-03-24  1684  
b1b8132a651cf6 drivers/vfio/vfio_main.c Alex Williamson 2022-10-07  1685
if (!vfio_file_is_group(file))
a905ad043f32bb drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-04  1686
return true;
c0560f51cf7747 drivers/vfio/vfio.c  Yan Zhao2020-03-24  1687  
c82e81ab256955 drivers/vfio/vfio_main.c Jason Gunthorpe 2022-09-29  1688
mutex_lock(>group_lock);
e0e29bdb594adf drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-16  1689
if (group->container) {
1408640d578887 drivers/vfio/vfio_main.c Jason Gunthorpe 2022-09-22 @1690
ret = vfio_container_ioctl_check_extension(group->container,
e0e29bdb594adf drivers/vfio/vfio.c  Jason Gunthorpe 2022-05-16  1691
   VFIO_DMA_CC_IOMMU);

But this returns true if vfio_container_ioctl_check_extension() returns
a negative error code.  (I haven't looked at the git branch and I
suspect it's different from linux-next)

14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1692
} else if (group->iommufd) {
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1693
struct vfio_device *device;
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1694  
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1695
/*
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1696
 * FIXME this is in the wrong order for KVM, the KVM will be set
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1697
 * after the group is opened and container set, but before the
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1698
 * device fds are created, so it will not see the iommufd bind
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1699
 * at this point.
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1700
 */
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1701
mutex_lock(>device_lock);
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1702
ret = true;
14b6d451b4bcfb drivers/vfio/vfio_main.c Jason Gunthorpe 2022-08-08  1703
list_for_each_entry(device, >device_list, group_next) {
14b6d451b4bcfb d

[kbuild] [linux-next:master 1261/3190] drivers/scsi/pm8001/pm8001_sas.c:996 pm8001_abort_task() warn: variable dereferenced before check 'task' (see line 986)

2022-10-25 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git   
master
head:   89bf6e28373beef9577fa71f996a5f73a569617c
commit: 0b639decf65160b1afd9993019be37d7869c0340 [1261/3190] scsi: pm8001: 
Modify task abort handling for SATA task
config: x86_64-randconfig-m001-20221024
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

smatch warnings:
drivers/scsi/pm8001/pm8001_sas.c:996 pm8001_abort_task() warn: variable 
dereferenced before check 'task' (see line 986)

vim +/task +996 drivers/scsi/pm8001/pm8001_sas.c

dbf9bfe615717d jack wang2009-10-14   984  int pm8001_abort_task(struct 
sas_task *task)
dbf9bfe615717d jack wang2009-10-14   985  {
0b639decf65160 John Garry   2022-10-17  @986struct pm8001_ccb_info *ccb = 
task->lldd_task;
  
^^^
Unchecked dereference

dbf9bfe615717d jack wang2009-10-14   987unsigned long flags;
1db49906d8fa87 Viswas G 2017-10-18   988u32 tag;
dbf9bfe615717d jack wang2009-10-14   989struct domain_device *dev ;
1db49906d8fa87 Viswas G 2017-10-18   990struct pm8001_hba_info 
*pm8001_ha;
dbf9bfe615717d jack wang2009-10-14   991struct pm8001_device 
*pm8001_dev;
869ddbdcae3b4f Viswas G 2017-10-18   992int rc = TMF_RESP_FUNC_FAILED, 
ret;
ee05cb71f9f7eb Ajish Koshy  2021-12-28   993u32 phy_id, port_id;
869ddbdcae3b4f Viswas G 2017-10-18   994struct sas_task_slow slow_task;
a961ea0afd632c akshatzen2021-01-09   995  
dbf9bfe615717d jack wang2009-10-14  @996if (unlikely(!task || 
!task->lldd_task || !task->dev))
  
Too late.  This warning will not trigger if you have the cross function
database because "task" can never actually be NULL so the checking is
wrong but harmless.

1db49906d8fa87 Viswas G 2017-10-18   997return 
TMF_RESP_FUNC_FAILED;
a961ea0afd632c akshatzen2021-01-09   998  
1db49906d8fa87 Viswas G 2017-10-18   999dev = task->dev;
1db49906d8fa87 Viswas G 2017-10-18  1000pm8001_dev = dev->lldd_dev;

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp  
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2730 dm_resume() error: we previously assumed 'aconnector->dc_link' could be null (see line 2717)

2022-10-25 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   337a0a0b63f1c30195733eaacf39e4310a592a68
commit: f4346fb3edf7720db3f7f5e1cab1f667cd024280 drm/amd/display: Fix 
allocate_mst_payload assert on resume
config: mips-randconfig-m031-20221018
compiler: mips64el-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

New smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2730 dm_resume() 
error: we previously assumed 'aconnector->dc_link' could be null (see line 2717)

Old smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1747 
amdgpu_dm_fini() warn: variable dereferenced before check 'adev->dm.dc' (see 
line 1720)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4019 
amdgpu_dm_backlight_update_status() error: testing array offset 'i' after use.
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:4061 
amdgpu_dm_backlight_get_brightness() error: testing array offset 'i' after use.
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:6530 
create_stream_for_sink() error: we previously assumed 'aconnector->dc_sink' 
could be null (see line 6429)
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8918 
handle_cursor_update() error: we previously assumed 'afb' could be null (see 
line 8877)

vim +2730 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

4562236b3bc0a2 Harry Wentland  2017-09-12  2606  static int dm_resume(void 
*handle)
4562236b3bc0a2 Harry Wentland  2017-09-12  2607  {
4562236b3bc0a2 Harry Wentland  2017-09-12  2608 struct amdgpu_device 
*adev = handle;
4a580877bdcb83 Luben Tuikov2020-08-24  2609 struct drm_device *ddev 
= adev_to_drm(adev);
4562236b3bc0a2 Harry Wentland  2017-09-12  2610 struct 
amdgpu_display_manager *dm = >dm;
c84dec2fe8837f Harry Wentland  2017-09-05  2611 struct 
amdgpu_dm_connector *aconnector;
4562236b3bc0a2 Harry Wentland  2017-09-12  2612 struct drm_connector 
*connector;
f8d2d39eb40694 Lyude Paul  2019-09-03  2613 struct 
drm_connector_list_iter iter;
4562236b3bc0a2 Harry Wentland  2017-09-12  2614 struct drm_crtc *crtc;
c2cea7063b85fc Leo (Sunpeng  Li2017-10-12  2615)struct drm_crtc_state 
*new_crtc_state;
fcb4019e090b95 Leo (Sunpeng  Li2017-11-01  2616)struct dm_crtc_state 
*dm_new_crtc_state;
fcb4019e090b95 Leo (Sunpeng  Li2017-11-01  2617)struct drm_plane *plane;
fcb4019e090b95 Leo (Sunpeng  Li2017-11-01  2618)struct drm_plane_state 
*new_plane_state;
fcb4019e090b95 Leo (Sunpeng  Li2017-11-01  2619)struct dm_plane_state 
*dm_new_plane_state;
113b7a01087211 Leo Li  2019-03-19  2620 struct dm_atomic_state 
*dm_state = to_dm_atomic_state(dm->atomic_obj.state);
fbbdadf2faf17c Bhawanpreet Lakha   2018-09-26  2621 enum dc_connection_type 
new_connection_type = dc_connection_none;
cdaae8371aa9d4 Bhawanpreet Lakha   2020-05-11  2622 struct dc_state 
*dc_state;
cdaae8371aa9d4 Bhawanpreet Lakha   2020-05-11  2623 int i, r, j;
cdaae8371aa9d4 Bhawanpreet Lakha   2020-05-11  2624  
53b3f8f40e6cff Dennis Li   2020-08-19  2625 if 
(amdgpu_in_reset(adev)) {
cdaae8371aa9d4 Bhawanpreet Lakha   2020-05-11  2626 dc_state = 
dm->cached_dc_state;
cdaae8371aa9d4 Bhawanpreet Lakha   2020-05-11  2627  
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2628 /*
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2629  * The 
dc->current_state is backed up into dm->cached_dc_state
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2630  * before we 
commit 0 streams.
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2631  *
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2632  * DC will 
clear link encoder assignments on the real state
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2633  * but the 
changes won't propagate over to the copy we made
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2634  * before the 0 
streams commit.
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2635  *
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2636  * DC expects 
that link encoder assignments are *not* valid
32685b32d825ca Nicholas Kazlauskas 2022-02-28  2637  * when 
committing a state, so as a workaround we can copy
32685b32d825ca Nicholas Kazlauskas 2022-02-28  2638  * off of the 
current state.
32685b32d825ca Nicholas Kazlauskas 2022-02-28  2639  *
32685b32d825ca Nicholas Kazlauskas 2022-02-28  2640  * We lose the 
previous assignments, but we had already
32685b32d825ca Nicholas Kazlauskas 2022-02-28  2641  * commit 0 
streams anyway.
6d63fcc2a334f7 Nicholas Kazlauskas 2021-11-09  2642  */
32685b32d825ca Nicholas Kaz

[kbuild] [linux-next:master 2112/3285] drivers/net/phy/phylink.c:588 phylink_validate_mask_caps() warn: variable dereferenced before check 'state' (see line 583)

2022-10-24 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   76cf65d1377f733af1e2a55233e3353ffa577f54
commit: f392a1846489720fc2e063d1210633b6cf4ec5a4 [2112/3285] net: phylink: 
provide phylink_validate_mask_caps() helper
config: microblaze-randconfig-m031-20221023
compiler: microblaze-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

New smatch warnings:
drivers/net/phy/phylink.c:588 phylink_validate_mask_caps() warn: variable 
dereferenced before check 'state' (see line 583)

Old smatch warnings:
drivers/net/phy/phylink.c:1104 phylink_change_inband_advert() error: we 
previously assumed 'pl->pcs' could be null (see line 1087)

vim +/state +588 drivers/net/phy/phylink.c

f392a184648972 Russell King (Oracle  2022-10-17  574) void 
phylink_validate_mask_caps(unsigned long *supported,
f392a184648972 Russell King (Oracle  2022-10-17  575)   
struct phylink_link_state *state,
f392a184648972 Russell King (Oracle  2022-10-17  576)   
unsigned long mac_capabilities)
34ae2c09d46a2d Russell King (Oracle  2021-11-15  577) {
34ae2c09d46a2d Russell King (Oracle  2021-11-15  578)   
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
3e6eab8f3ef93c Sean Anderson 2022-09-20  579unsigned long caps;
34ae2c09d46a2d Russell King (Oracle  2021-11-15  580) 
34ae2c09d46a2d Russell King (Oracle  2021-11-15  581)   
phylink_set_port_modes(mask);
34ae2c09d46a2d Russell King (Oracle  2021-11-15  582)   phylink_set(mask, 
Autoneg);
f392a184648972 Russell King (Oracle  2022-10-17 @583)   caps = 
phylink_get_capabilities(state->interface, mac_capabilities,


b7e9294885b610 Sean Anderson 2022-09-20  584
state->rate_matching);


Unchecked dereferences

3e6eab8f3ef93c Sean Anderson 2022-09-20  585
phylink_caps_to_linkmodes(mask, caps);
34ae2c09d46a2d Russell King (Oracle  2021-11-15  586) 
34ae2c09d46a2d Russell King (Oracle  2021-11-15  587)   linkmode_and(supported, 
supported, mask);
f392a184648972 Russell King (Oracle  2022-10-17 @588)   if (state)
^
Check for NULL

34ae2c09d46a2d Russell King (Oracle  2021-11-15  589)   
linkmode_and(state->advertising, state->advertising, mask);
34ae2c09d46a2d Russell King (Oracle  2021-11-15  590) }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:3047 commit_planes_for_stream() error: we previously assumed 'top_pipe_to_program' could be null (see line 2870)

2022-10-24 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   e35184f321518acadb681928a016da21a9a20c13
commit: a689e8d1f80012f90384ebac9dcfac4201f9f77e drm/amd/display: check 
top_pipe_to_program pointer
config: mips-randconfig-m031-20221018
compiler: mips64el-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

New smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:3047 
commit_planes_for_stream() error: we previously assumed 'top_pipe_to_program' 
could be null (see line 2870)

Old smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:883 dc_construct_ctx() warn: 
possible memory leak of 'dc_ctx'
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:2285 det_surface_update() 
warn: variable dereferenced before check 'u->surface' (see line 2252)
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:3058 
commit_planes_for_stream() warn: variable dereferenced before check 'stream' 
(see line 2869)

vim +/top_pipe_to_program +3047 
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c

482812d56698ef Wesley Chalmers   2021-03-12  2868  
71b81f1275e0b5 Wenjing Liu   2020-01-22  2869   if ((update_type != 
UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed)
a689e8d1f80012 Yang Li   2021-11-15 @2870   if 
(top_pipe_to_program &&
a689e8d1f80012 Yang Li   2021-11-15  2871   
top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {

Check for NULL

cfafe238b58596 Dan Carpenter 2020-07-14  2872   if 
(should_use_dmub_lock(stream->link)) {
dc6e2448558d68 Wyatt Wood2020-05-27  2873   
union dmub_hw_lock_flags hw_locks = { 0 };
dc6e2448558d68 Wyatt Wood2020-05-27  2874   
struct dmub_hw_lock_inst_flags inst_flags = { 0 };
dc6e2448558d68 Wyatt Wood2020-05-27  2875  
dc6e2448558d68 Wyatt Wood2020-05-27  2876   
hw_locks.bits.lock_dig = 1;
dc6e2448558d68 Wyatt Wood2020-05-27  2877   
inst_flags.dig_inst = top_pipe_to_program->stream_res.tg->inst;
dc6e2448558d68 Wyatt Wood2020-05-27  2878  
dc6e2448558d68 Wyatt Wood2020-05-27  2879   
dmub_hw_lock_mgr_cmd(dc->ctx->dmub_srv,
dc6e2448558d68 Wyatt Wood2020-05-27  2880   
true,
dc6e2448558d68 Wyatt Wood2020-05-27  2881   
_locks,
dc6e2448558d68 Wyatt Wood2020-05-27  2882   
_flags);
dc6e2448558d68 Wyatt Wood2020-05-27  2883   } else
71b81f1275e0b5 Wenjing Liu   2020-01-22  2884   
top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable(
71b81f1275e0b5 Wenjing Liu   2020-01-22  2885   
top_pipe_to_program->stream_res.tg);
dc6e2448558d68 Wyatt Wood2020-05-27  2886   }
71b81f1275e0b5 Wenjing Liu   2020-01-22  2887  
f9ccaf6da03134 Roy Chan  2021-07-21  2888   if 
(should_lock_all_pipes && dc->hwss.interdependent_update_lock)
009114f6df8415 Anthony Koo   2020-01-14  2889   
dc->hwss.interdependent_update_lock(dc, context, true);
009114f6df8415 Anthony Koo   2020-01-14  2890   else
009114f6df8415 Anthony Koo   2020-01-14  2891   /* Lock the top 
pipe while updating plane addrs, since freesync requires
009114f6df8415 Anthony Koo   2020-01-14  2892*  plane addr 
update event triggers to be synchronized.
009114f6df8415 Anthony Koo   2020-01-14  2893*  
top_pipe_to_program is expected to never be NULL
009114f6df8415 Anthony Koo   2020-01-14  2894*/
009114f6df8415 Anthony Koo   2020-01-14  2895   
dc->hwss.pipe_control_lock(dc, top_pipe_to_program, true);
009114f6df8415 Anthony Koo   2020-01-14  2896  
1e7e86c43f38d2 Samson Tam2018-05-01  2897   // Stream updates
1e7e86c43f38d2 Samson Tam2018-05-01  2898   if (stream_update)
1e7e86c43f38d2 Samson Tam2018-05-01  2899   
commit_planes_do_stream_update(dc, stream, stream_update, update_type, context);
1e7e86c43f38d2 Samson Tam2018-05-01  2900  
671a6246e0d365 Yongqiang Sun 2017-09-22  2901   if (surface_count == 0) 
{
671a6246e0d365 Yongqiang Sun 2017-09-22  2902   /*
671a6246e0d365 Yongqiang Sun 2017-09-22  2903* In case of 
turning off screen, no need to program front end a second time.
1e7e86c43f38d2 Samson Tam2018-05-01  2904* jus

[kbuild] Re: arch/x86/kvm/x86.c:4988 kvm_arch_tsc_set_attr() warn: check for integer overflow 'offset'

2022-10-12 Thread Dan Carpenter
On Tue, Oct 11, 2022 at 03:02:28PM +0200, Paolo Bonzini wrote:
> On 10/10/22 20:39, Sean Christopherson wrote:
> > > 828ca89628bfcb Oliver Upton 2021-09-16 @4988  tsc = 
> > > kvm_scale_tsc(vcpu, rdtsc(), vcpu->arch.l1_tsc_scaling_ratio) + offset;
> > > 
> > > Smatch hates obvious user triggerable integer overflows...  No checking
> > > on offset.
> > 
> > This is ok, and even necessary, e.g. if the host TSC > guest TSC.
> 
> (which in fact is the common case).  Also this is unsigned which is fine
> according to the C standard, though I understand that static analyzers want
> to be stricter.
> 
> > Is there anything
> > we can do in KVM to help Smatch avoid false positives?  Or do you/Smatch 
> > already
> > maintain a list of known false positives?
> 
> Seconded.

Thanks for your feedback.

I could probably make a rule to ignore clock related stuff.  That's
honestly been a known source of false positives for a while.  I kind of
have the infrastructure so it's not super hard to do actually... I'll do
that.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] [chrome-os:chromeos-5.15 35/61] drivers/gpu/drm/msm/msm_gem_submit.c:963 msm_ioctl_gem_submit() warn: variable dereferenced before check 'submit' (see line 784)

2022-10-05 Thread Dan Carpenter
tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel 
chromeos-5.15
head:   642d76bcaf8d0918daf38d6bc51bd8d3366f423c
commit: d0f54fc5d9c6aa63d0fcd0f5ce9614b578c36675 [35/61] FROMGIT: drm/msm: 
Small submit cleanup
config: mips-randconfig-m031-20221004
compiler: mipsel-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

smatch warnings:
drivers/gpu/drm/msm/msm_gem_submit.c:963 msm_ioctl_gem_submit() warn: variable 
dereferenced before check 'submit' (see line 784)

vim +/submit +963 drivers/gpu/drm/msm/msm_gem_submit.c

7198e6b03155f6 Rob Clark 2013-07-19  723  int 
msm_ioctl_gem_submit(struct drm_device *dev, void *data,
7198e6b03155f6 Rob Clark 2013-07-19  724struct drm_file 
*file)
7198e6b03155f6 Rob Clark 2013-07-19  725  {
7198e6b03155f6 Rob Clark 2013-07-19  726struct msm_drm_private 
*priv = dev->dev_private;
7198e6b03155f6 Rob Clark 2013-07-19  727struct 
drm_msm_gem_submit *args = data;
7198e6b03155f6 Rob Clark 2013-07-19  728struct msm_file_private 
*ctx = file->driver_priv;
e3e24ee51ed2c4 Rob Clark 2021-07-27  729struct msm_gem_submit 
*submit = NULL;

No need for this initializer.  Plus submit is normally error pointer or
valid so it's potentially confusing.

c01a958eca6e7f Rob Clark 2016-02-03  730struct msm_gpu *gpu = 
priv->gpu;
f7de15450e906e Jordan Crouse 2017-10-20  731struct 
msm_gpu_submitqueue *queue;
f97decac5f4c2d Jordan Crouse 2017-10-20  732struct msm_ringbuffer 
*ring;
ab723b7a992a19 Bas Nieuwenhuizen 2020-01-24  733struct 
msm_submit_post_dep *post_deps = NULL;
ab723b7a992a19 Bas Nieuwenhuizen 2020-01-24  734struct drm_syncobj 
**syncobjs_to_reset = NULL;
4cd0945901a6dd Rob Clark 2016-06-16  735int out_fence_fd = -1;
92ec0767710797 Daniel Vetter 2019-11-20  736bool has_ww_ticket = 
false;
7198e6b03155f6 Rob Clark 2013-07-19  737unsigned i;
d0f54fc5d9c6aa Rob Clark 2022-08-02  738int ret;
375f9a63a66bae Rob Clark 2021-07-27  739  
c01a958eca6e7f Rob Clark 2016-02-03  740if (!gpu)
c01a958eca6e7f Rob Clark 2016-02-03  741return -ENXIO;
c01a958eca6e7f Rob Clark 2016-02-03  742  
ab723b7a992a19 Bas Nieuwenhuizen 2020-01-24  743if (args->pad)
ab723b7a992a19 Bas Nieuwenhuizen 2020-01-24  744return -EINVAL;
ab723b7a992a19 Bas Nieuwenhuizen 2020-01-24  745  
923e59a26bbe58 Rob Clark 2022-05-02  746if 
(unlikely(!ctx->aspace) && !capable(CAP_SYS_RAWIO)) {
923e59a26bbe58 Rob Clark 2022-05-02  747
DRM_ERROR_RATELIMITED("IOMMU support or CAP_SYS_RAWIO required!\n");
923e59a26bbe58 Rob Clark 2022-05-02  748return -EPERM;
923e59a26bbe58 Rob Clark 2022-05-02  749}
923e59a26bbe58 Rob Clark 2022-05-02  750  
7198e6b03155f6 Rob Clark 2013-07-19  751/* for now, we just 
have 3d pipe.. eventually this would need to
7198e6b03155f6 Rob Clark 2013-07-19  752 * be more clever to 
dispatch to appropriate gpu module:
7198e6b03155f6 Rob Clark 2013-07-19  753 */
d9c181e22a0599 Rob Clark 2016-04-23  754if 
(MSM_PIPE_ID(args->flags) != MSM_PIPE_3D0)
d9c181e22a0599 Rob Clark 2016-04-23  755return -EINVAL;
d9c181e22a0599 Rob Clark 2016-04-23  756  
d9c181e22a0599 Rob Clark 2016-04-23  757if 
(MSM_PIPE_FLAGS(args->flags) & ~MSM_SUBMIT_FLAGS)
7198e6b03155f6 Rob Clark 2013-07-19  758return -EINVAL;
7198e6b03155f6 Rob Clark 2013-07-19  759  
6a8bd08d0465b2 Rob Clark 2017-12-13  760if (args->flags & 
MSM_SUBMIT_SUDO) {
6a8bd08d0465b2 Rob Clark 2017-12-13  761if 
(!IS_ENABLED(CONFIG_DRM_MSM_GPU_SUDO) ||
6a8bd08d0465b2 Rob Clark 2017-12-13  762
!capable(CAP_SYS_RAWIO))
6a8bd08d0465b2 Rob Clark 2017-12-13  763return 
-EINVAL;
6a8bd08d0465b2 Rob Clark 2017-12-13  764}
6a8bd08d0465b2 Rob Clark 2017-12-13  765  
f7de15450e906e Jordan Crouse 2017-10-20  766queue = 
msm_submitqueue_get(ctx, args->queueid);
f7de15450e906e Jordan Crouse 2017-10-20  767if (!queue)
f7de15450e906e Jordan Crouse 2017-10-20  768return -ENOENT;
f7de15450e906e Jordan Crouse 2017-10-20  769  
fc40e5e10c3bcc Rob Clark 2021-07-27  770ring = 
gpu->rb[queue->ring_nr];
f97decac5f4c2d Jordan Crouse 2017-10-20  771  
1d8a5ca436ee4a Rob Clark 2021-07-27  772if (args->flags & 
MSM_SUBMIT_FENCE_FD_OUT) {
1d8a5ca436ee4a Rob Clark 2021-07-27

[kbuild] drivers/net/ethernet/wangxun/ngbe/ngbe_main.c:54 ngbe_shutdown() error: uninitialized symbol 'wake'.

2022-10-05 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git   
master
head:   2bca25eaeba6190efbfcb38ed169bd7ee43b5aaf
commit: e79e40c83b9fd4e8b9b9d4fc9093d25b7a67c745 net: ngbe: Add build support 
for ngbe
config: powerpc-randconfig-m041-20221002
compiler: powerpc-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

smatch warnings:
drivers/net/ethernet/wangxun/ngbe/ngbe_main.c:54 ngbe_shutdown() error: 
uninitialized symbol 'wake'.

vim +/wake +54 drivers/net/ethernet/wangxun/ngbe/ngbe_main.c

e79e40c83b9fd4 Mengyuan Lou 2022-08-26  47  static void ngbe_shutdown(struct 
pci_dev *pdev)
e79e40c83b9fd4 Mengyuan Lou 2022-08-26  48  {
e79e40c83b9fd4 Mengyuan Lou 2022-08-26  49  bool wake;
e79e40c83b9fd4 Mengyuan Lou 2022-08-26  50  
e79e40c83b9fd4 Mengyuan Lou 2022-08-26  51  ngbe_dev_shutdown(pdev, );

ngbe_dev_shutdown() does not do anything to wake.

e79e40c83b9fd4 Mengyuan Lou 2022-08-26  52  
e79e40c83b9fd4 Mengyuan Lou 2022-08-26  53  if (system_state == 
SYSTEM_POWER_OFF) {
e79e40c83b9fd4 Mengyuan Lou 2022-08-26 @54  pci_wake_from_d3(pdev, 
wake);
   

Uninitialized.


e79e40c83b9fd4 Mengyuan Lou 2022-08-26  55  
pci_set_power_state(pdev, PCI_D3hot);
e79e40c83b9fd4 Mengyuan Lou 2022-08-26  56  }
e79e40c83b9fd4 Mengyuan Lou 2022-08-26  57  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp  
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] [jic23-iio:testing 55/63] drivers/iio/adc/mcp3911.c:441 mcp3911_probe() warn: passing zero to 'PTR_ERR'

2022-09-27 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head:   df957373c1649c74b78bf2fcfd144f0c3baa68a5
commit: 08a65f61db69ae4850c3c15e8fbe6293a09a998d [55/63] iio: adc: mcp3911: add 
support for interrupts
config: openrisc-randconfig-m041-20220926
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

smatch warnings:
drivers/iio/adc/mcp3911.c:441 mcp3911_probe() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +441 drivers/iio/adc/mcp3911.c

3a89b289df5df4 Marcus Folkesson 2018-08-08  366  static int 
mcp3911_probe(struct spi_device *spi)
3a89b289df5df4 Marcus Folkesson 2018-08-08  367  {
3a89b289df5df4 Marcus Folkesson 2018-08-08  368 struct iio_dev 
*indio_dev;
3a89b289df5df4 Marcus Folkesson 2018-08-08  369 struct mcp3911 *adc;
3a89b289df5df4 Marcus Folkesson 2018-08-08  370 int ret;
3a89b289df5df4 Marcus Folkesson 2018-08-08  371  
3a89b289df5df4 Marcus Folkesson 2018-08-08  372 indio_dev = 
devm_iio_device_alloc(>dev, sizeof(*adc));
3a89b289df5df4 Marcus Folkesson 2018-08-08  373 if (!indio_dev)
3a89b289df5df4 Marcus Folkesson 2018-08-08  374 return -ENOMEM;
3a89b289df5df4 Marcus Folkesson 2018-08-08  375  
3a89b289df5df4 Marcus Folkesson 2018-08-08  376 adc = 
iio_priv(indio_dev);
3a89b289df5df4 Marcus Folkesson 2018-08-08  377 adc->spi = spi;
3a89b289df5df4 Marcus Folkesson 2018-08-08  378  
3a89b289df5df4 Marcus Folkesson 2018-08-08  379 adc->vref = 
devm_regulator_get_optional(>spi->dev, "vref");
3a89b289df5df4 Marcus Folkesson 2018-08-08  380 if (IS_ERR(adc->vref)) {
3a89b289df5df4 Marcus Folkesson 2018-08-08  381 if 
(PTR_ERR(adc->vref) == -ENODEV) {
3a89b289df5df4 Marcus Folkesson 2018-08-08  382 
adc->vref = NULL;
3a89b289df5df4 Marcus Folkesson 2018-08-08  383 } else {
3a89b289df5df4 Marcus Folkesson 2018-08-08  384 
dev_err(>spi->dev,
3a89b289df5df4 Marcus Folkesson 2018-08-08  385 
"failed to get regulator (%ld)\n",
3a89b289df5df4 Marcus Folkesson 2018-08-08  386 
PTR_ERR(adc->vref));
3a89b289df5df4 Marcus Folkesson 2018-08-08  387 return 
PTR_ERR(adc->vref);
3a89b289df5df4 Marcus Folkesson 2018-08-08  388 }
3a89b289df5df4 Marcus Folkesson 2018-08-08  389  
3a89b289df5df4 Marcus Folkesson 2018-08-08  390 } else {
3a89b289df5df4 Marcus Folkesson 2018-08-08  391 ret = 
regulator_enable(adc->vref);
3a89b289df5df4 Marcus Folkesson 2018-08-08  392 if (ret)
3a89b289df5df4 Marcus Folkesson 2018-08-08  393 return 
ret;
0e0a07adaff971 Marcus Folkesson 2022-08-15  394  
0e0a07adaff971 Marcus Folkesson 2022-08-15  395 ret = 
devm_add_action_or_reset(>dev,
0e0a07adaff971 Marcus Folkesson 2022-08-15  396 
mcp3911_cleanup_regulator, adc->vref);
0e0a07adaff971 Marcus Folkesson 2022-08-15  397 if (ret)
0e0a07adaff971 Marcus Folkesson 2022-08-15  398 return 
ret;
3a89b289df5df4 Marcus Folkesson 2018-08-08  399 }
3a89b289df5df4 Marcus Folkesson 2018-08-08  400  
0e0a07adaff971 Marcus Folkesson 2022-08-15  401 adc->clki = 
devm_clk_get_enabled(>spi->dev, NULL);
3a89b289df5df4 Marcus Folkesson 2018-08-08  402 if (IS_ERR(adc->clki)) {
3a89b289df5df4 Marcus Folkesson 2018-08-08  403 if 
(PTR_ERR(adc->clki) == -ENOENT) {
3a89b289df5df4 Marcus Folkesson 2018-08-08  404 
adc->clki = NULL;
3a89b289df5df4 Marcus Folkesson 2018-08-08  405 } else {
3a89b289df5df4 Marcus Folkesson 2018-08-08  406 
dev_err(>spi->dev,
3a89b289df5df4 Marcus Folkesson 2018-08-08  407 
"failed to get adc clk (%ld)\n",
3a89b289df5df4 Marcus Folkesson 2018-08-08  408 
PTR_ERR(adc->clki));
0e0a07adaff971 Marcus Folkesson 2022-08-15  409 return 
PTR_ERR(adc->clki);
3a89b289df5df4 Marcus Folkesson 2018-08-08  410 }
3a89b289df5df4 Marcus Folkesson 2018-08-08  411 }
3a89b289df5df4 Marcus Folkesson 2018-08-08  412  
4efc1c614d3348 Jonathan Cameron 2021-12-05  413 ret = 
mcp3911_config(adc);
3a89b289df5df4 Marcus Folkesson 2018-08-08  414 if (ret)
0e0a07adaff971 Marcus Folkesson 2022-08-15  415 return ret;
3a89b289df5df4 Marcus Folkesson 2018-08-08  416  
08a65f61db69ae Marcus Folkesson 2022-08-15  417 if 
(device_property_read_bool(>spi->dev, "microchip,data-ready-hiz"))
08a65f61db69ae Marcus Folkesson 2022-08-15  418  

[kbuild] [char-misc:char-misc-testing 29/36] drivers/nvmem/lan9662-otpc.c:43 lan9662_otp_wait_flag_clear() warn: signedness bug returning '(-110)'

2022-09-27 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 
char-misc-testing
head:   0f65caa911019561d71ceb70f0d1c7a965b3045f
commit: 9e8f208ad5229ddda97cd4a83ecf89c735d99592 [29/36] nvmem: lan9662-otp: 
add support
config: openrisc-randconfig-m041-20220926
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 
| Reported-by: Dan Carpenter 

smatch warnings:
drivers/nvmem/lan9662-otpc.c:43 lan9662_otp_wait_flag_clear() warn: signedness 
bug returning '(-110)'

vim +43 drivers/nvmem/lan9662-otpc.c

9e8f208ad5229d Horatiu Vultur 2022-09-16  39  static bool 
lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag)
9e8f208ad5229d Horatiu Vultur 2022-09-16  40  {
9e8f208ad5229d Horatiu Vultur 2022-09-16  41u32 val;
9e8f208ad5229d Horatiu Vultur 2022-09-16  42  
9e8f208ad5229d Horatiu Vultur 2022-09-16 @43return readl_poll_timeout(reg, 
val, !(val & flag),
9e8f208ad5229d Horatiu Vultur 2022-09-16  44  
OTP_SLEEP_US, OTP_TIMEOUT_US);


readl_poll_timeout() returns zero on success or a negative error code.
Better to make lan9662_otp_wait_flag_clear() return ints.  Returning
false/true (as opposed to true/false or zero/negative) for
success/failure is pants.

9e8f208ad5229d Horatiu Vultur 2022-09-16  45  }
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH net-next v5 8/9] net: marvell: prestera: Add neighbour cache accounting

2022-09-13 Thread Dan Carpenter
Hi Yevhen,

url:
https://github.com/intel-lab-lkp/linux/commits/Yevhen-Orlov/net-marvell-prestera-add-nexthop-routes-offloading/20220909-065815
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
9f8f1933dce555d3c246f447f54fca8de8889da9
config: openrisc-randconfig-m041-20220907
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/net/ethernet/marvell/prestera/prestera_router.c:751 
__prestera_k_arb_n_lpm_set() error: uninitialized symbol 'fib_node'.

vim +/fib_node +751 drivers/net/ethernet/marvell/prestera/prestera_router.c

5a826d874f2b0e Yevhen Orlov 2022-09-09  715  static void
5a826d874f2b0e Yevhen Orlov 2022-09-09  716  __prestera_k_arb_n_lpm_set(struct 
prestera_switch *sw,
5a826d874f2b0e Yevhen Orlov 2022-09-09  717struct 
prestera_kern_neigh_cache *n_cache,
5a826d874f2b0e Yevhen Orlov 2022-09-09  718bool enabled)
5a826d874f2b0e Yevhen Orlov 2022-09-09  719  {
5a826d874f2b0e Yevhen Orlov 2022-09-09  720 struct 
prestera_nexthop_group_key nh_grp_key;
5a826d874f2b0e Yevhen Orlov 2022-09-09  721 struct 
prestera_kern_fib_cache_key fc_key;
5a826d874f2b0e Yevhen Orlov 2022-09-09  722 struct prestera_kern_fib_cache 
*fib_cache;
5a826d874f2b0e Yevhen Orlov 2022-09-09  723 struct prestera_fib_node 
*fib_node;
5a826d874f2b0e Yevhen Orlov 2022-09-09  724 struct prestera_fib_key fib_key;
5a826d874f2b0e Yevhen Orlov 2022-09-09  725  
5a826d874f2b0e Yevhen Orlov 2022-09-09  726 /* Exception for fc with prefix 
32: LPM entry is already used by fib */
5a826d874f2b0e Yevhen Orlov 2022-09-09  727 memset(_key, 0, 
sizeof(fc_key));
5a826d874f2b0e Yevhen Orlov 2022-09-09  728 fc_key.addr = n_cache->key.addr;
5a826d874f2b0e Yevhen Orlov 2022-09-09  729 fc_key.prefix_len = 
PRESTERA_IP_ADDR_PLEN(n_cache->key.addr.v);
5a826d874f2b0e Yevhen Orlov 2022-09-09  730 /* But better to use tb_id of 
route, which pointed to this neighbour. */
5a826d874f2b0e Yevhen Orlov 2022-09-09  731 /* We take it from rif, because 
rif inconsistent.
5a826d874f2b0e Yevhen Orlov 2022-09-09  732  * Must be separated in_rif and 
out_rif.
5a826d874f2b0e Yevhen Orlov 2022-09-09  733  * Also note: for each fib 
pointed to this neigh should be separated
5a826d874f2b0e Yevhen Orlov 2022-09-09  734  *neigh lpm entry 
(for each ingress vr)
5a826d874f2b0e Yevhen Orlov 2022-09-09  735  */
5a826d874f2b0e Yevhen Orlov 2022-09-09  736 fc_key.kern_tb_id = 
l3mdev_fib_table(n_cache->key.dev);
5a826d874f2b0e Yevhen Orlov 2022-09-09  737 fib_cache = 
prestera_kern_fib_cache_find(sw, _key);
5a826d874f2b0e Yevhen Orlov 2022-09-09  738 if (!fib_cache || 
!fib_cache->reachable) {
5a826d874f2b0e Yevhen Orlov 2022-09-09  739 memset(_key, 0, 
sizeof(fib_key));
5a826d874f2b0e Yevhen Orlov 2022-09-09  740 fib_key.addr = 
n_cache->key.addr;
5a826d874f2b0e Yevhen Orlov 2022-09-09  741 fib_key.prefix_len = 
PRESTERA_IP_ADDR_PLEN(n_cache->key.addr.v);
5a826d874f2b0e Yevhen Orlov 2022-09-09  742 fib_key.tb_id = 
prestera_fix_tb_id(fc_key.kern_tb_id);
5a826d874f2b0e Yevhen Orlov 2022-09-09  743 fib_node = 
prestera_fib_node_find(sw, _key);
5a826d874f2b0e Yevhen Orlov 2022-09-09  744 if (!enabled && 
fib_node) {
5a826d874f2b0e Yevhen Orlov 2022-09-09  745 if 
(prestera_fib_node_util_is_neighbour(fib_node))
5a826d874f2b0e Yevhen Orlov 2022-09-09  746 
prestera_fib_node_destroy(sw, fib_node);
5a826d874f2b0e Yevhen Orlov 2022-09-09  747 return;
5a826d874f2b0e Yevhen Orlov 2022-09-09  748 }
5a826d874f2b0e Yevhen Orlov 2022-09-09  749 }

fib_node not initialized on else path.

5a826d874f2b0e Yevhen Orlov 2022-09-09  750  
5a826d874f2b0e Yevhen Orlov 2022-09-09 @751 if (enabled && !fib_node) {
5a826d874f2b0e Yevhen Orlov 2022-09-09  752 memset(_grp_key, 0, 
sizeof(nh_grp_key));
5a826d874f2b0e Yevhen Orlov 2022-09-09  753 
prestera_util_nc_key2nh_key(_cache->key,
5a826d874f2b0e Yevhen Orlov 2022-09-09  754 
_grp_key.neigh[0]);
5a826d874f2b0e Yevhen Orlov 2022-09-09  755 fib_node = 
prestera_fib_node_create(sw, _key,
5a826d874f2b0e Yevhen Orlov 2022-09-09  756 
PRESTERA_FIB_TYPE_UC_NH,
5a826d874f2b0e Yevhen Orlov 2022-09-09  757 
_grp_key);
5a826d874f2b0e Yevhen Orlov 2022-09-09  758 if (!fib_node)
5a826d874f2b0e Yevhen Orlov 2022-09-09  759 pr_err("%s 
failed ip=%pI4n", "prestera_fib_node_create",
5a826d874f2b0e Yevhen Orlov 2022-09-09  760
_key.

[kbuild] [linux-next:master 4120/6188] drivers/crypto/aspeed/aspeed-hace.c:133 aspeed_hace_probe() warn: platform_get_irq() does not return zero

2022-09-08 Thread Dan Carpenter
Hi Herbert,

FYI, the error/warning was bisected to this commit, please ignore it if it's 
irrelevant.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git   
master
head:   47c191411b68a771261be3dc0bd6f68394cef358
commit: 31b39755e32568b43c80814c5e13d7b1ab796d73 [4120/6188] crypto: aspeed - 
Enable compile testing
config: openrisc-randconfig-m041-20220907
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/crypto/aspeed/aspeed-hace.c:133 aspeed_hace_probe() warn: 
platform_get_irq() does not return zero

vim +133 drivers/crypto/aspeed/aspeed-hace.c

108713a713c7e4b Neal Liu 2022-08-18   96  static int aspeed_hace_probe(struct 
platform_device *pdev)
108713a713c7e4b Neal Liu 2022-08-18   97  {
62f58b1637b7c8d Neal Liu 2022-08-18   98struct aspeed_engine_crypto 
*crypto_engine;
108713a713c7e4b Neal Liu 2022-08-18   99const struct of_device_id 
*hace_dev_id;
108713a713c7e4b Neal Liu 2022-08-18  100struct aspeed_engine_hash 
*hash_engine;
108713a713c7e4b Neal Liu 2022-08-18  101struct aspeed_hace_dev 
*hace_dev;
108713a713c7e4b Neal Liu 2022-08-18  102struct resource *res;
108713a713c7e4b Neal Liu 2022-08-18  103int rc;
108713a713c7e4b Neal Liu 2022-08-18  104  
108713a713c7e4b Neal Liu 2022-08-18  105hace_dev = 
devm_kzalloc(>dev, sizeof(struct aspeed_hace_dev),
108713a713c7e4b Neal Liu 2022-08-18  106
GFP_KERNEL);
108713a713c7e4b Neal Liu 2022-08-18  107if (!hace_dev)
108713a713c7e4b Neal Liu 2022-08-18  108return -ENOMEM;
108713a713c7e4b Neal Liu 2022-08-18  109  
108713a713c7e4b Neal Liu 2022-08-18  110hace_dev_id = 
of_match_device(aspeed_hace_of_matches, >dev);
108713a713c7e4b Neal Liu 2022-08-18  111if (!hace_dev_id) {
108713a713c7e4b Neal Liu 2022-08-18  112dev_err(>dev, 
"Failed to match hace dev id\n");
108713a713c7e4b Neal Liu 2022-08-18  113return -EINVAL;
108713a713c7e4b Neal Liu 2022-08-18  114}
108713a713c7e4b Neal Liu 2022-08-18  115  
108713a713c7e4b Neal Liu 2022-08-18  116hace_dev->dev = >dev;
108713a713c7e4b Neal Liu 2022-08-18  117hace_dev->version = (unsigned 
long)hace_dev_id->data;
108713a713c7e4b Neal Liu 2022-08-18  118hash_engine = 
_dev->hash_engine;
62f58b1637b7c8d Neal Liu 2022-08-18  119crypto_engine = 
_dev->crypto_engine;
108713a713c7e4b Neal Liu 2022-08-18  120  
108713a713c7e4b Neal Liu 2022-08-18  121res = 
platform_get_resource(pdev, IORESOURCE_MEM, 0);
108713a713c7e4b Neal Liu 2022-08-18  122  
108713a713c7e4b Neal Liu 2022-08-18  123platform_set_drvdata(pdev, 
hace_dev);
108713a713c7e4b Neal Liu 2022-08-18  124  
108713a713c7e4b Neal Liu 2022-08-18  125hace_dev->regs = 
devm_ioremap_resource(>dev, res);
108713a713c7e4b Neal Liu 2022-08-18  126if (!hace_dev->regs) {
108713a713c7e4b Neal Liu 2022-08-18  127dev_err(>dev, 
"Failed to map resources\n");
108713a713c7e4b Neal Liu 2022-08-18  128return -ENOMEM;
108713a713c7e4b Neal Liu 2022-08-18  129}
108713a713c7e4b Neal Liu 2022-08-18  130  
108713a713c7e4b Neal Liu 2022-08-18  131/* Get irq number and register 
it */
108713a713c7e4b Neal Liu 2022-08-18  132hace_dev->irq = 
platform_get_irq(pdev, 0);
108713a713c7e4b Neal Liu 2022-08-18 @133if (!hace_dev->irq) {

This should be:

if (hace_dev->irq < 0)
return hace_dev->irq;

platform_get_irq() does not return zero, but if it did then treat it
as success.

108713a713c7e4b Neal Liu 2022-08-18  134dev_err(>dev, 
"Failed to get interrupt\n");
108713a713c7e4b Neal Liu 2022-08-18  135return -ENXIO;
108713a713c7e4b Neal Liu 2022-08-18  136}
108713a713c7e4b Neal Liu 2022-08-18  137  
108713a713c7e4b Neal Liu 2022-08-18  138rc = 
devm_request_irq(>dev, hace_dev->irq, aspeed_hace_irq, 0,
108713a713c7e4b Neal Liu 2022-08-18  139  
dev_name(>dev), hace_dev);
108713a713c7e4b Neal Liu 2022-08-18  140if (rc) {
108713a713c7e4b Neal Liu 2022-08-18  141dev_err(>dev, 
"Failed to request interrupt\n");
108713a713c7e4b Neal Liu 2022-08-18  142return rc;
108713a713c7e4b Neal Liu 2022-08-18  143}
108713a713c7e4b Neal Liu 2022-08-18  144  
108713a713c7e4b Neal Liu 2022-08-18  145/* Get clk and enable it */
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [linux-next:master 2079/2594] fs/btrfs/volumes.c:6546 __btrfs_map_block() error: we previously assumed 'mirror_num_p' could be null (see line 6373)

2022-08-24 Thread Dan Carpenter
On Wed, Aug 24, 2022 at 07:35:27AM +0200, Christoph Hellwig wrote:
> On Wed, Aug 24, 2022 at 08:28:26AM +0300, Dan Carpenter wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
> >   master
> > head:   05477f3653b82d8b3bcf39d2937d9893124976db
> > commit: 51bf2819055847ce90006a368f8d2c07f408dd33 [2079/2594] btrfs: make 
> > the btrfs_io_context allocation in __btrfs_map_block optional
> > config: nios2-randconfig-m031-20220824 
> > (https://download.01.org/0day-ci/archive/20220824/202208240734.u4y7q6sw-...@intel.com/config
> >   )
> > compiler: nios2-linux-gcc (GCC) 12.1.0
> > 
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> > 
> > New smatch warnings:
> 
> The calling convention implies that either smap and mirror_num_p are both
> NULL or neither.  We could add an extra check to shut up the validator
> if this really helps.

No need.  That's a simple relationship and the warning should be
silenced if you have the cross function DB information.  (It's just not
possible to build the cross function DB for the number of builds that
the kbuild-bot does).

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH v3 1/3] driver: input: matric-keypad: switch to gpiod

2022-08-22 Thread Dan Carpenter
Hi,

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Gireesh-Hiremath-in-bosch-com/driver-input-matric-keypad-switch-to-gpiod/20220819-151155
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: i386-randconfig-m021 
(https://download.01.org/0day-ci/archive/20220819/202208192340.m1xmltj5-...@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/input/keyboard/matrix_keypad.c:432 matrix_keypad_parse_dt() error: 
uninitialized symbol 'ret'.

Old smatch warnings:
drivers/input/keyboard/matrix_keypad.c:439 matrix_keypad_parse_dt() error: 
uninitialized symbol 'ret'.

vim +/ret +432 drivers/input/keyboard/matrix_keypad.c

5298cc4cc753bb Bill Pemberton   2012-11-23  380  static struct 
matrix_keypad_platform_data *
4a83eecff65bd3 AnilKumar Ch 2012-11-20  381  matrix_keypad_parse_dt(struct 
device *dev)
4a83eecff65bd3 AnilKumar Ch 2012-11-20  382  {
4a83eecff65bd3 AnilKumar Ch 2012-11-20  383 struct 
matrix_keypad_platform_data *pdata;
4a83eecff65bd3 AnilKumar Ch 2012-11-20  384 struct device_node *np 
= dev->of_node;
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  385 struct gpio_desc 
**gpios;
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  386 struct gpio_desc *desc;
d55bda1b3e7c5a Christian Hoff   2018-11-12  387 int ret, i, nrow, ncol;
4a83eecff65bd3 AnilKumar Ch 2012-11-20  388  
4a83eecff65bd3 AnilKumar Ch 2012-11-20  389 if (!np) {
4a83eecff65bd3 AnilKumar Ch 2012-11-20  390 dev_err(dev, 
"device lacks DT data\n");
4a83eecff65bd3 AnilKumar Ch 2012-11-20  391 return 
ERR_PTR(-ENODEV);
4a83eecff65bd3 AnilKumar Ch 2012-11-20  392 }
4a83eecff65bd3 AnilKumar Ch 2012-11-20  393  
4a83eecff65bd3 AnilKumar Ch 2012-11-20  394 pdata = 
devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
4a83eecff65bd3 AnilKumar Ch 2012-11-20  395 if (!pdata) {
4a83eecff65bd3 AnilKumar Ch 2012-11-20  396 dev_err(dev, 
"could not allocate memory for platform data\n");
4a83eecff65bd3 AnilKumar Ch 2012-11-20  397 return 
ERR_PTR(-ENOMEM);
4a83eecff65bd3 AnilKumar Ch 2012-11-20  398 }
4a83eecff65bd3 AnilKumar Ch 2012-11-20  399  
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  400 pdata->num_row_gpios = 
nrow = gpiod_count(dev, "row");
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  401 pdata->num_col_gpios = 
ncol = gpiod_count(dev, "col");
e80beb27d2f81a Grant Likely 2013-02-12  402 if (nrow <= 0 || ncol 
<= 0) {
4a83eecff65bd3 AnilKumar Ch 2012-11-20  403 dev_err(dev, 
"number of keypad rows/columns not specified\n");
4a83eecff65bd3 AnilKumar Ch 2012-11-20  404 return 
ERR_PTR(-EINVAL);
4a83eecff65bd3 AnilKumar Ch 2012-11-20  405 }
4a83eecff65bd3 AnilKumar Ch 2012-11-20  406  
4a83eecff65bd3 AnilKumar Ch 2012-11-20  407 if (of_get_property(np, 
"linux,no-autorepeat", NULL))
4a83eecff65bd3 AnilKumar Ch 2012-11-20  408 
pdata->no_autorepeat = true;
aeda5003d0b987 Dmitry Torokhov  2015-07-16  409  
aeda5003d0b987 Dmitry Torokhov  2015-07-16  410 pdata->wakeup = 
of_property_read_bool(np, "wakeup-source") ||
aeda5003d0b987 Dmitry Torokhov  2015-07-16  411 
of_property_read_bool(np, "linux,wakeup"); /* legacy */
aeda5003d0b987 Dmitry Torokhov  2015-07-16  412  
aa0e26bb786b00 David Rivshin2017-03-29  413 
pdata->drive_inactive_cols =
aa0e26bb786b00 David Rivshin2017-03-29  414 
of_property_read_bool(np, "drive-inactive-cols");
aa0e26bb786b00 David Rivshin2017-03-29  415  
4a83eecff65bd3 AnilKumar Ch 2012-11-20  416 
of_property_read_u32(np, "debounce-delay-ms", >debounce_ms);
4a83eecff65bd3 AnilKumar Ch 2012-11-20  417 
of_property_read_u32(np, "col-scan-delay-us",
4a83eecff65bd3 AnilKumar Ch 2012-11-20  418 
>col_scan_delay_us);
4a83eecff65bd3 AnilKumar Ch 2012-11-20  419  
a86854d0c599b3 Kees Cook2018-06-12  420 gpios = 
devm_kcalloc(dev,
a86854d0c599b3 Kees Cook2018-06-12  421  
pdata->num_row_gpios + pdata->num_col_gpios,
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  422  
sizeof(*gpios),
4a83eecff65bd3 AnilKumar Ch 2012-11-20  423  
GFP_KERNEL);
4a83eecff65bd3 AnilKumar Ch 2012-11-20  424 if (!gpios) {
4a83eecff65bd3 AnilKumar Ch 2012-11-20  425  

[kbuild] drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c:142 mlx5_eswitch_set_rule_source_port() warn: variable dereferenced before check 'attr' (see line 130)

2022-08-19 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   5d6a0f4da9275f6c212de3378673ba91241a
commit: cb0d54cbf94866b48a73e10a73a55655f808cc7c net/mlx5e: Fix wrong source 
vport matching on tunnel rule
config: parisc-randconfig-m031-20220807 
(https://download.01.org/0day-ci/archive/20220815/202208150418.3wdxndnr-...@intel.com/config)
compiler: hppa-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c:142 
mlx5_eswitch_set_rule_source_port() warn: variable dereferenced before check 
'attr' (see line 130)

vim +/attr +142 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

c01cfd0f111511 Jianbo Liu  2019-06-25  123  static void
c01cfd0f111511 Jianbo Liu  2019-06-25  124  
mlx5_eswitch_set_rule_source_port(struct mlx5_eswitch *esw,
c01cfd0f111511 Jianbo Liu  2019-06-25  125  
  struct mlx5_flow_spec *spec,
a508728a4c8bfa Vlad Buslov 2021-01-25  126  
  struct mlx5_flow_attr *attr,
b055ecf5827d81 Mark Bloch  2020-10-12  127  
  struct mlx5_eswitch *src_esw,
b055ecf5827d81 Mark Bloch  2020-10-12  128  
  u16 vport)
c01cfd0f111511 Jianbo Liu  2019-06-25  129  {
166f431ec6beaf Ariel Levkovich 2021-04-29 @130  struct 
mlx5_esw_flow_attr *esw_attr = attr->esw_attr;

  ^^
Existing code has a dereference

166f431ec6beaf Ariel Levkovich 2021-04-29  131  u32 metadata;
c01cfd0f111511 Jianbo Liu  2019-06-25  132  void *misc2;
c01cfd0f111511 Jianbo Liu  2019-06-25  133  void *misc;
c01cfd0f111511 Jianbo Liu  2019-06-25  134  
c01cfd0f111511 Jianbo Liu  2019-06-25  135  /* Use metadata 
matching because vport is not represented by single
c01cfd0f111511 Jianbo Liu  2019-06-25  136   * VHCA in dual-port 
RoCE mode, and matching on source vport may fail.
c01cfd0f111511 Jianbo Liu  2019-06-25  137   */
c01cfd0f111511 Jianbo Liu  2019-06-25  138  if 
(mlx5_eswitch_vport_match_metadata_enabled(esw)) {
a508728a4c8bfa Vlad Buslov 2021-01-25  139  if 
(mlx5_esw_indir_table_decap_vport(attr))
a508728a4c8bfa Vlad Buslov 2021-01-25  140  vport = 
mlx5_esw_indir_table_decap_vport(attr);
166f431ec6beaf Ariel Levkovich 2021-04-29  141  
cb0d54cbf94866 Ariel Levkovich 2022-03-15 @142  if (attr && 
!attr->chain && esw_attr->int_port)

Checked too late

166f431ec6beaf Ariel Levkovich 2021-04-29  143  
metadata =
166f431ec6beaf Ariel Levkovich 2021-04-29  144  
mlx5e_tc_int_port_get_metadata_for_match(esw_attr->int_port);
166f431ec6beaf Ariel Levkovich 2021-04-29  145  else
166f431ec6beaf Ariel Levkovich 2021-04-29  146  
metadata =
166f431ec6beaf Ariel Levkovich 2021-04-29  147  
mlx5_eswitch_get_vport_metadata_for_match(src_esw, vport);
166f431ec6beaf Ariel Levkovich 2021-04-29  148  
c01cfd0f111511 Jianbo Liu  2019-06-25  149  misc2 = 
MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters_2);
166f431ec6beaf Ariel Levkovich 2021-04-29  150  
MLX5_SET(fte_match_set_misc2, misc2, metadata_reg_c_0, metadata);
c01cfd0f111511 Jianbo Liu  2019-06-25  151  
c01cfd0f111511 Jianbo Liu  2019-06-25  152  misc2 = 
MLX5_ADDR_OF(fte_match_param, spec->match_criteria, misc_parameters_2);
0f0d3827c0b4d6 Paul Blakey 2020-02-16  153  
MLX5_SET(fte_match_set_misc2, misc2, metadata_reg_c_0,
0f0d3827c0b4d6 Paul Blakey 2020-02-16  154   
mlx5_eswitch_get_vport_metadata_mask());
c01cfd0f111511 Jianbo Liu  2019-06-25  155  
c01cfd0f111511 Jianbo Liu  2019-06-25  156  
spec->match_criteria_enable |= MLX5_MATCH_MISC_PARAMETERS_2;
c01cfd0f111511 Jianbo Liu  2019-06-25  157  } else {
c01cfd0f111511 Jianbo Liu  2019-06-25  158  misc = 
MLX5_ADDR_OF(fte_match_param, spec->match_value, misc_parameters);
b055ecf5827d81 Mark Bloch  2020-10-12  159  
MLX5_SET(fte_match_set_misc, misc, source_port, vport);
c01cfd0f111511 Jianbo Liu  2019-06-25  160  
c01cfd0f111511 Jianbo Liu  2019-06-25  161  if 
(MLX5_CAP_ESW(esw->dev, merged_eswitch))
c01cfd0f111511 Jianbo Liu  2019-06-25  162  
MLX5_SET(fte_match_set_misc, misc,
c01

[kbuild] Re: [PATCH] Input: HID-rmi - ignore to rmi_hid_read_block after system resumes.

2022-08-19 Thread Dan Carpenter
Hi margeyang,

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/margeyang/Input-HID-rmi-ignore-to-rmi_hid_read_block-after-system-resumes/20220801-145006
base:   https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
config: x86_64-randconfig-m001-20220801 
(https://download.01.org/0day-ci/archive/20220814/202208142212.qb3fvm5l-...@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/hid/hid-rmi.c:263 rmi_hid_read_block() error: uninitialized symbol 
'ret'.

vim +/ret +263 drivers/hid/hid-rmi.c

0b2c7a897378f1 Andrew Duggan  2017-01-05  188  static int 
rmi_hid_read_block(struct rmi_transport_dev *xport, u16 addr,
0b2c7a897378f1 Andrew Duggan  2017-01-05  189   void *buf, 
size_t len)
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  190  {
0b2c7a897378f1 Andrew Duggan  2017-01-05  191   struct rmi_data *data = 
container_of(xport, struct rmi_data, xport);
0b2c7a897378f1 Andrew Duggan  2017-01-05  192   struct hid_device *hdev 
= data->hdev;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  193   int ret;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  194   int bytes_read;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  195   int bytes_needed;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  196   int retries;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  197   int read_input_count;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  198  
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  199   
mutex_lock(>page_mutex);
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  200  
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  201   if (RMI_PAGE(addr) != 
data->page) {
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  202   ret = 
rmi_set_page(hdev, RMI_PAGE(addr));
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  203   if (ret < 0)
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  204   goto 
exit;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  205   }
30a3df7ece6145 Marge Yang 2022-08-01  206   if (ignoreonce == 1) {
30a3df7ece6145 Marge Yang 2022-08-01  207   
dev_err(>dev,
30a3df7ece6145 Marge Yang 2022-08-01  208   
"ignoreonce (%d)\n",
30a3df7ece6145 Marge Yang 2022-08-01  209   
ignoreonce);
30a3df7ece6145 Marge Yang 2022-08-01  210   ignoreonce = 0;

"ret" not initialized here.

30a3df7ece6145 Marge Yang 2022-08-01  211   goto exit;
30a3df7ece6145 Marge Yang 2022-08-01  212   }
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  213   for (retries = 5; 
retries > 0; retries--) {
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  214   
data->writeReport[0] = RMI_READ_ADDR_REPORT_ID;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  215   
data->writeReport[1] = 0; /* old 1 byte read count */
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  216   
data->writeReport[2] = addr & 0xFF;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  217   
data->writeReport[3] = (addr >> 8) & 0xFF;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  218   
data->writeReport[4] = len  & 0xFF;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  219   
data->writeReport[5] = (len >> 8) & 0xFF;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  220  
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  221   
set_bit(RMI_READ_REQUEST_PENDING, >flags);
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  222  
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  223   ret = 
rmi_write_report(hdev, data->writeReport,
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  224   
data->output_report_size);
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  225   if (ret != 
data->output_report_size) {
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  226   
dev_err(>dev,
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  227   
"failed to write request output report (%d)\n",
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  228   
ret);
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  229   goto 
exit;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  230   }
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  231  
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  232   bytes_read = 0;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  233   bytes_needed = 
len;
9fb6bf02e3ad04 Benjamin Tissoires 2014-04-07  234   while 
(bytes_read < len) {
9fb6bf02e3ad04 Benjamin Tissoires 2014

[kbuild] security/loadpin/loadpin.c:365 dm_verity_ioctl() warn: maybe return -EFAULT instead of the bytes remaining?

2022-08-19 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   aea23e7c464bfdec04b52cf61edb62030e9e0d0a
commit: 3f805f8cc23ba35679dd01446929292911c2b469 LoadPin: Enable loading from 
trusted dm-verity devices
config: s390-randconfig-m031-20220810 
(https://download.01.org/0day-ci/archive/20220814/202208141119.rkgsgoz7-...@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
security/loadpin/loadpin.c:365 dm_verity_ioctl() warn: maybe return -EFAULT 
instead of the bytes remaining?

vim +365 security/loadpin/loadpin.c

3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  355  static long 
dm_verity_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  356  {
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  357void __user *uarg = 
(void __user *)arg;
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  358unsigned int fd;
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  359int rc;
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  360  
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  361switch (cmd) {
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  362case 
LOADPIN_IOC_SET_TRUSTED_VERITY_DIGESTS:
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  363rc = 
copy_from_user(, uarg, sizeof(fd));
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  364if (rc)
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27 @365return 
rc;

The copy_from_user() function returns the number of bytes remaining to
be copied.  It should be:

if (copy_from_user(, uarg, sizeof(fd)))
return -EFAULT;

3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  366  
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  367return 
read_trusted_verity_root_digests(fd);
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  368  
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  369default:
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  370return -EINVAL;
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  371}
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  372  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] [broonie-sound:for-6.1 3/22] sound/soc/codecs/src4xxx.c:288 src4xxx_hw_params() error: uninitialized symbol 'pj'.

2022-08-19 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 
for-6.1
head:   6256547352fa21356de8d26b058e50d719ecc0d2
commit: 4e6bedd3c396014ba70de2b4c9995c8e024e82b3 [3/22] ASoC: codecs: add 
support for the TI SRC4392 codec
config: arm-randconfig-m031-20220815 
(https://download.01.org/0day-ci/archive/20220817/202208170317.bcgqtwpu-...@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
sound/soc/codecs/src4xxx.c:288 src4xxx_hw_params() error: uninitialized symbol 
'pj'.
sound/soc/codecs/src4xxx.c:293 src4xxx_hw_params() error: uninitialized symbol 
'jd'.
sound/soc/codecs/src4xxx.c:298 src4xxx_hw_params() error: uninitialized symbol 
'd'.

vim +/pj +288 sound/soc/codecs/src4xxx.c

4e6bedd3c396014 Matt Flax 2022-08-10  216  static int src4xxx_hw_params(struct 
snd_pcm_substream *substream,
4e6bedd3c396014 Matt Flax 2022-08-10  217   struct 
snd_pcm_hw_params *params,
4e6bedd3c396014 Matt Flax 2022-08-10  218   struct 
snd_soc_dai *dai)
4e6bedd3c396014 Matt Flax 2022-08-10  219  {
4e6bedd3c396014 Matt Flax 2022-08-10  220   struct snd_soc_component 
*component = dai->component;
4e6bedd3c396014 Matt Flax 2022-08-10  221   struct src4xxx *src4xxx = 
snd_soc_component_get_drvdata(component);
4e6bedd3c396014 Matt Flax 2022-08-10  222   unsigned int mclk_div;
4e6bedd3c396014 Matt Flax 2022-08-10  223   int val, pj, jd, d;
4e6bedd3c396014 Matt Flax 2022-08-10  224   int reg;
4e6bedd3c396014 Matt Flax 2022-08-10  225   int ret;
4e6bedd3c396014 Matt Flax 2022-08-10  226  
4e6bedd3c396014 Matt Flax 2022-08-10  227   switch (dai->id) {
4e6bedd3c396014 Matt Flax 2022-08-10  228   case SRC4XXX_PORTB:
4e6bedd3c396014 Matt Flax 2022-08-10  229   reg = 
SRC4XXX_PORTB_CTL_06;
4e6bedd3c396014 Matt Flax 2022-08-10  230   break;
4e6bedd3c396014 Matt Flax 2022-08-10  231   default:
4e6bedd3c396014 Matt Flax 2022-08-10  232   reg = 
SRC4XXX_PORTA_CTL_04;
4e6bedd3c396014 Matt Flax 2022-08-10  233   break;
4e6bedd3c396014 Matt Flax 2022-08-10  234   }
4e6bedd3c396014 Matt Flax 2022-08-10  235  
4e6bedd3c396014 Matt Flax 2022-08-10  236   if (src4xxx->master[dai->id]) {
4e6bedd3c396014 Matt Flax 2022-08-10  237   mclk_div = 
src4xxx->mclk_hz/params_rate(params);
4e6bedd3c396014 Matt Flax 2022-08-10  238   if (src4xxx->mclk_hz != 
mclk_div*params_rate(params)) {
4e6bedd3c396014 Matt Flax 2022-08-10  239   
dev_err(component->dev,
4e6bedd3c396014 Matt Flax 2022-08-10  240   "mclk 
%d / rate %d has a remainder.\n",
4e6bedd3c396014 Matt Flax 2022-08-10  241   
src4xxx->mclk_hz, params_rate(params));
4e6bedd3c396014 Matt Flax 2022-08-10  242   return -EINVAL;
4e6bedd3c396014 Matt Flax 2022-08-10  243   }
4e6bedd3c396014 Matt Flax 2022-08-10  244  
4e6bedd3c396014 Matt Flax 2022-08-10  245   val = ((int)mclk_div - 
128) / 128;
4e6bedd3c396014 Matt Flax 2022-08-10  246   if ((val < 0) | (val > 
3)) {
4e6bedd3c396014 Matt Flax 2022-08-10  247   
dev_err(component->dev,
4e6bedd3c396014 Matt Flax 2022-08-10  248   "div 
register setting %d is out of range\n",
4e6bedd3c396014 Matt Flax 2022-08-10  249   val);
4e6bedd3c396014 Matt Flax 2022-08-10  250   
dev_err(component->dev,
4e6bedd3c396014 Matt Flax 2022-08-10  251   
"unsupported sample rate %d Hz for the master clock of %d Hz\n",
4e6bedd3c396014 Matt Flax 2022-08-10  252   
params_rate(params), src4xxx->mclk_hz);
4e6bedd3c396014 Matt Flax 2022-08-10  253   return -EINVAL;
4e6bedd3c396014 Matt Flax 2022-08-10  254   }
4e6bedd3c396014 Matt Flax 2022-08-10  255  
4e6bedd3c396014 Matt Flax 2022-08-10  256   /* set the TX DIV */
4e6bedd3c396014 Matt Flax 2022-08-10  257   ret = 
regmap_update_bits(src4xxx->regmap,
4e6bedd3c396014 Matt Flax 2022-08-10  258   
SRC4XXX_TX_CTL_07, SRC4XXX_TX_MCLK_DIV_MASK,
4e6bedd3c396014 Matt Flax 2022-08-10  259   
val<dev,
4e6bedd3c396014 Matt Flax 2022-08-10  262   
"Couldn't set the TX's div register to %d << %d = 0x%x\n",
4e6bedd3c396014 Matt Flax 2022-08-10  263   val, 
SRC4XXX_TX_MCLK_DIV_SHIFT,
4e6bedd3c396014 Matt Flax 2022-08-10  264   
val<mclk_hz) {
4e6bedd3c396014 Matt Flax 2022-08-10  270   case 24576000:
4e6bedd3c396014 Matt Flax 2022-08-10  271 

[kbuild] [asahilinux:bits/020-t6000-dart 7/11] drivers/iommu/apple-dart.c:918 apple_dart_probe() warn: missing error code 'ret'

2022-08-19 Thread Dan Carpenter
tree:   https://github.com/AsahiLinux/linux bits/020-t6000-dart
head:   a1335782bc0044bf5fc4ec4f8a4a785ecb02a652
commit: fe20c64837d183c09082887d0c96d338b438a855 [7/11] iommu: dart: Support 
>64 stream IDs
config: mips-randconfig-m031-20220818 
(https://download.01.org/0day-ci/archive/20220818/202208181055.jpfyieir-...@intel.com/config)
compiler: mips64el-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/iommu/apple-dart.c:918 apple_dart_probe() warn: missing error code 'ret'

vim +/ret +918 drivers/iommu/apple-dart.c

46d1fb072e76b1 Sven Peter 2021-08-03  870  static int 
apple_dart_probe(struct platform_device *pdev)
46d1fb072e76b1 Sven Peter 2021-08-03  871  {
46d1fb072e76b1 Sven Peter 2021-08-03  872   int ret;
46d1fb072e76b1 Sven Peter 2021-08-03  873   u32 dart_params[2];
46d1fb072e76b1 Sven Peter 2021-08-03  874   struct resource *res;
46d1fb072e76b1 Sven Peter 2021-08-03  875   struct apple_dart *dart;
46d1fb072e76b1 Sven Peter 2021-08-03  876   struct device *dev = >dev;
46d1fb072e76b1 Sven Peter 2021-08-03  877  
46d1fb072e76b1 Sven Peter 2021-08-03  878   dart = devm_kzalloc(dev, 
sizeof(*dart), GFP_KERNEL);
46d1fb072e76b1 Sven Peter 2021-08-03  879   if (!dart)
46d1fb072e76b1 Sven Peter 2021-08-03  880   return -ENOMEM;
46d1fb072e76b1 Sven Peter 2021-08-03  881  
46d1fb072e76b1 Sven Peter 2021-08-03  882   dart->dev = dev;
15720227e18019 Sven Peter 2021-11-02  883   dart->hw = 
of_device_get_match_data(dev);
46d1fb072e76b1 Sven Peter 2021-08-03  884   spin_lock_init(>lock);
46d1fb072e76b1 Sven Peter 2021-08-03  885  
a15932f4377062 Yang Yingliang 2022-04-25  886   dart->regs = 
devm_platform_get_and_ioremap_resource(pdev, 0, );
a15932f4377062 Yang Yingliang 2022-04-25  887   if (IS_ERR(dart->regs))
a15932f4377062 Yang Yingliang 2022-04-25  888   return 
PTR_ERR(dart->regs);
a15932f4377062 Yang Yingliang 2022-04-25  889  
46d1fb072e76b1 Sven Peter 2021-08-03  890   if (resource_size(res) < 
0x4000) {
46d1fb072e76b1 Sven Peter 2021-08-03  891   dev_err(dev, "MMIO 
region too small (%pr)\n", res);
46d1fb072e76b1 Sven Peter 2021-08-03  892   return -EINVAL;
46d1fb072e76b1 Sven Peter 2021-08-03  893   }
46d1fb072e76b1 Sven Peter 2021-08-03  894  
46d1fb072e76b1 Sven Peter 2021-08-03  895   dart->irq = 
platform_get_irq(pdev, 0);
46d1fb072e76b1 Sven Peter 2021-08-03  896   if (dart->irq < 0)
46d1fb072e76b1 Sven Peter 2021-08-03  897   return -ENODEV;
46d1fb072e76b1 Sven Peter 2021-08-03  898  
46d1fb072e76b1 Sven Peter 2021-08-03  899   ret = 
devm_clk_bulk_get_all(dev, >clks);
46d1fb072e76b1 Sven Peter 2021-08-03  900   if (ret < 0)
46d1fb072e76b1 Sven Peter 2021-08-03  901   return ret;
46d1fb072e76b1 Sven Peter 2021-08-03  902   dart->num_clks = ret;
46d1fb072e76b1 Sven Peter 2021-08-03  903  
46d1fb072e76b1 Sven Peter 2021-08-03  904   ret = 
clk_bulk_prepare_enable(dart->num_clks, dart->clks);
46d1fb072e76b1 Sven Peter 2021-08-03  905   if (ret)
46d1fb072e76b1 Sven Peter 2021-08-03  906   return ret;
46d1fb072e76b1 Sven Peter 2021-08-03  907  
46d1fb072e76b1 Sven Peter 2021-08-03  908   dart_params[0] = 
readl(dart->regs + DART_PARAMS1);
46d1fb072e76b1 Sven Peter 2021-08-03  909   dart_params[1] = 
readl(dart->regs + DART_PARAMS2);
46d1fb072e76b1 Sven Peter 2021-08-03  910   dart->pgsize = 1 << 
FIELD_GET(DART_PARAMS_PAGE_SHIFT, dart_params[0]);
46d1fb072e76b1 Sven Peter 2021-08-03  911   dart->supports_bypass = 
dart_params[1] & DART_PARAMS_BYPASS_SUPPORT;
fe20c64837d183 Hector Martin  2022-06-28  912  
fe20c64837d183 Hector Martin  2022-06-28  913   dart->num_streams = 
dart->hw->max_sid_count;
fe20c64837d183 Hector Martin  2022-06-28  914  
fe20c64837d183 Hector Martin  2022-06-28  915   if (dart->num_streams > 
DART_MAX_STREAMS) {
fe20c64837d183 Hector Martin  2022-06-28  916   dev_err(>dev, 
"Too many streams (%d > %d)\n",
fe20c64837d183 Hector Martin  2022-06-28  917   
dart->num_streams, DART_MAX_STREAMS);
fe20c64837d183 Hector Martin  2022-06-28 @918   goto err_clk_disable;

ret = -EINVAL;

fe20c64837d183 Hector Martin  2022-06-28  919   }
fe20c64837d183 Hector Martin  2022-06-28  920  
46d1fb072e76b1 Sven Peter 2021-08-03  921   dart->force_bypass = 
dart->pgsize > PAGE_SIZE;
46d1fb072e76b1 Sven Peter 2021-08-03  922  
fe20c64837d183 Hector Martin  2022-06-28  923   ret = apple_dart_hw_reset(dart);
fe20c64837d183 Hector Martin  2022-06-28  924   if (ret)
fe20c64837d183 Hector Martin  2022-06-28  925   goto err_clk_disable;
fe20c64837d183 Hector Martin  2022-06-28  926  
46d1fb072e76b1 Sve

[kbuild] [samba-ksmbd:ksmbd-for-next-next 12/12] fs/ksmbd/smbacl.c:1213 smb_check_perm_dacl() warn: variable dereferenced before check 'pntsd' (see line 1212)

2022-08-03 Thread Dan Carpenter
tree:   git://git.samba.org/ksmbd.git ksmbd-for-next-next
head:   d0b73d20ca9100c7b969b65d8a1ff49cdd1fa9c9
commit: d0b73d20ca9100c7b969b65d8a1ff49cdd1fa9c9 [12/12] ksmbd: fix heap-based 
overflow in set_ntacl_dacl()
config: arc-randconfig-m041-20220731 
(https://download.01.org/0day-ci/archive/20220801/202208010716.io52cjih-...@intel.com/config)
compiler: arceb-elf-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
fs/ksmbd/smbacl.c:1213 smb_check_perm_dacl() warn: variable dereferenced before 
check 'pntsd' (see line 1212)
fs/ksmbd/smb2pdu.c:5182 smb2_get_info_sec() error: uninitialized symbol 
'secdesclen'.

Old smatch warnings:
fs/ksmbd/smb2pdu.c:549 smb2_allocate_rsp_buf() warn: Please consider using 
kvzalloc instead of kvmalloc
fs/ksmbd/smb2pdu.c:6123 smb2_read_pipe() warn: Please consider using kvzalloc 
instead of kvmalloc
fs/ksmbd/smb2pdu.c:6275 smb2_read() warn: Please consider using kvzalloc 
instead of kvmalloc
fs/ksmbd/smb2pdu.c:6424 smb2_write_rdma_channel() warn: Please consider using 
kvzalloc instead of kvmalloc

vim +/pntsd +1213 fs/ksmbd/smbacl.c

ef24c962d0f290 fs/ksmbd/smbacl.c Hyunchul Lee  2021-06-30  1188  int 
smb_check_perm_dacl(struct ksmbd_conn *conn, struct path *path,
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1189 
__le32 *pdaccess, int uid)
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1190  {
465d720485eff1 fs/ksmbd/smbacl.c Hyunchul Lee  2021-07-03  1191 struct 
user_namespace *user_ns = mnt_user_ns(path->mnt);
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1192 struct 
smb_ntsd *pntsd = NULL;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1193 struct 
smb_acl *pdacl;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1194 struct 
posix_acl *posix_acls;
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1195 int rc 
= 0, pntsd_size, acl_size, aces_size, pdacl_size, dacl_offset;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1196 struct 
smb_sid sid;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1197 int 
granted = le32_to_cpu(*pdaccess & ~FILE_MAXIMAL_ACCESS_LE);
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1198 struct 
smb_ace *ace;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1199 int i, 
found = 0;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1200 
unsigned int access_bits = 0;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1201 struct 
smb_ace *others_ace = NULL;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1202 struct 
posix_acl_entry *pa_entry;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1203 
unsigned int sid_type = SIDOWNER;
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1204 
unsigned short ace_size;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1205  
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1206 
ksmbd_debug(SMB, "check permission using windows acl\n");
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1207 
pntsd_size = ksmbd_vfs_get_sd_xattr(conn, user_ns,
af34983e831587 fs/ksmbd/smbacl.c Hyunchul Lee  2021-06-30  1208 
path->dentry, );
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1209 if 
(pntsd_size <= 0)
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1210 
goto err_out;
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1211  
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28 @1212 
dacl_offset = le32_to_cpu(pntsd->dacloffset);

  ^
Dereference

d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28 @1213 if 
(!pntsd || !pntsd->dacloffset ||
 
^
Checked too late

d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1214 
(dacl_offset + sizeof(struct smb_acl) > pntsd_size))
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1215 
goto err_out;
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1216  
e2f34481b24db2 fs/cifsd/smbacl.c Namjae Jeon   2021-03-16  1217 pdacl = 
(struct smb_acl *)((char *)pntsd + le32_to_cpu(pntsd->dacloffset));
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1218 
acl_size = pntsd_size - dacl_offset;
d0b73d20ca9100 fs/ksmbd/smbacl.c Namjae Jeon   2022-07-28  1219 
pdacl_size = le16_to_cpu(pdacl->size);
50355b0b20103a fs/cifsd/smbacl.c Namjae Jeon   2021-03-19  1220  
d0b73d20ca9100 fs

[kbuild] [fdmanana:dio_fixes 3/42] fs/btrfs/sysfs.c:811 btrfs_force_chunk_alloc_store() warn: passing zero to 'PTR_ERR'

2022-07-12 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux.git 
dio_fixes
head:   f01450d13f24e9a01436b60f5f2596ef650c790f
commit: fce393f3e59414984ba87693911080747b08ed09 [3/42] btrfs: sysfs: add 
force_chunk_alloc trigger to force allocation
config: riscv-randconfig-m031-20220709
compiler: riscv32-linux-gcc (GCC) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
fs/btrfs/sysfs.c:811 btrfs_force_chunk_alloc_store() warn: passing zero to 
'PTR_ERR'

vim +/PTR_ERR +811 fs/btrfs/sysfs.c

fce393f3e59414 Stefan Roesch 2022-02-08  782  static ssize_t 
btrfs_force_chunk_alloc_store(struct kobject *kobj,
fce393f3e59414 Stefan Roesch 2022-02-08  783
 struct kobj_attribute *a,
fce393f3e59414 Stefan Roesch 2022-02-08  784
 const char *buf, size_t len)
fce393f3e59414 Stefan Roesch 2022-02-08  785  {
fce393f3e59414 Stefan Roesch 2022-02-08  786struct btrfs_space_info 
*space_info = to_space_info(kobj);
fce393f3e59414 Stefan Roesch 2022-02-08  787struct btrfs_fs_info *fs_info = 
to_fs_info(get_btrfs_kobj(kobj));
fce393f3e59414 Stefan Roesch 2022-02-08  788struct btrfs_trans_handle 
*trans;
fce393f3e59414 Stefan Roesch 2022-02-08  789bool val;
fce393f3e59414 Stefan Roesch 2022-02-08  790int ret;
fce393f3e59414 Stefan Roesch 2022-02-08  791  
fce393f3e59414 Stefan Roesch 2022-02-08  792if (!capable(CAP_SYS_ADMIN))
fce393f3e59414 Stefan Roesch 2022-02-08  793return -EPERM;
fce393f3e59414 Stefan Roesch 2022-02-08  794  
fce393f3e59414 Stefan Roesch 2022-02-08  795if (sb_rdonly(fs_info->sb))
fce393f3e59414 Stefan Roesch 2022-02-08  796return -EROFS;
fce393f3e59414 Stefan Roesch 2022-02-08  797  
fce393f3e59414 Stefan Roesch 2022-02-08  798ret = kstrtobool(buf, );
fce393f3e59414 Stefan Roesch 2022-02-08  799if (ret)
fce393f3e59414 Stefan Roesch 2022-02-08  800return ret;
fce393f3e59414 Stefan Roesch 2022-02-08  801  
fce393f3e59414 Stefan Roesch 2022-02-08  802if (!val)
fce393f3e59414 Stefan Roesch 2022-02-08  803return -EINVAL;
fce393f3e59414 Stefan Roesch 2022-02-08  804  
fce393f3e59414 Stefan Roesch 2022-02-08  805/*
fce393f3e59414 Stefan Roesch 2022-02-08  806 * This is unsafe to be called 
from sysfs context and may cause
fce393f3e59414 Stefan Roesch 2022-02-08  807 * unexpected problems.
fce393f3e59414 Stefan Roesch 2022-02-08  808 */
fce393f3e59414 Stefan Roesch 2022-02-08  809trans = 
btrfs_start_transaction(fs_info->tree_root, 0);
fce393f3e59414 Stefan Roesch 2022-02-08  810if (!trans)
fce393f3e59414 Stefan Roesch 2022-02-08 @811return PTR_ERR(trans);

This bug is already fixed upstread.  Need to pull the NULL -> IS_ERR()
patch.

fce393f3e59414 Stefan Roesch 2022-02-08  812ret = 
btrfs_force_chunk_alloc(trans, space_info->flags);
fce393f3e59414 Stefan Roesch 2022-02-08  813btrfs_end_transaction(trans);
fce393f3e59414 Stefan Roesch 2022-02-08  814  
fce393f3e59414 Stefan Roesch 2022-02-08  815if (ret == 1)
fce393f3e59414 Stefan Roesch 2022-02-08  816return len;
fce393f3e59414 Stefan Roesch 2022-02-08  817  
fce393f3e59414 Stefan Roesch 2022-02-08  818return -ENOSPC;
fce393f3e59414 Stefan Roesch 2022-02-08  819  }
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH v7 2/8] media: uvcvideo: Add support for per-device control mapping overrides

2022-07-01 Thread Dan Carpenter
On Fri, Jul 01, 2022 at 01:16:23AM +0200, Ricardo Ribalda wrote:
> >
> > "mapping" uninitialized if chain->dev->info->mappings is NULL.
> >
> > 10bdca4191d7a8 drivers/media/usb/uvc/uvc_ctrl.c   Ricardo Ribalda  
> > 2022-06-17  2457
> > 10bdca4191d7a8 drivers/media/usb/uvc/uvc_ctrl.c   Ricardo Ribalda  
> > 2022-06-17  2458 /* Process common mappings next. */
> > 10bdca4191d7a8 drivers/media/usb/uvc/uvc_ctrl.c   Ricardo Ribalda  
> > 2022-06-17 @2459 mend = mapping + ARRAY_SIZE(uvc_ctrl_mappings);
> > 
> >^^^
> >
> > 10bdca4191d7a8 drivers/media/usb/uvc/uvc_ctrl.c   Ricardo Ribalda  
> > 2022-06-17  2460 for (mapping = uvc_ctrl_mappings; mapping < mend; 
> > ++mapping) {
> >
> > I'm surprised this made it through testing...  Anyway, the easier way to
> > to iterate through an array of structs is just say:
> 
> There is already a new version under review that fixes this:
> 
> https://patchwork.linuxtv.org/project/linux-media/patch/20220617235610.321917-3-riba...@chromium.org/
>  
> 
> 
> >
> > for (i = 0; i < ARRAY_SIZE(uvc_ctrl_mappings); i++) {
> > mapping = _ctrl_mappings[i];
> >
> 
> I agree, and that is what I normally used, but that driver iterate this way...

That's not really an excuse.  Imagine you were a lemming and Disney
employees were trying to chase you off a cliff!

> 
> Thanks again!
> 
> PS: Any idea why the test was triggered 14+ days after the patch was sent?

I don't know how kbuild works.  I run Smatch on linux-next so I would
have caught it eventually.  Plus the clang people would have caught it.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: Fwd: [zen:5.17/ksm 3/5] mm/madvise.c:1529 __do_sys_pmadv_ksm() error: uninitialized symbol 'ret'.

2022-06-06 Thread Dan Carpenter
On Mon, Jun 06, 2022 at 04:10:42PM +0200, Oleksandr Natalenko wrote:
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1504 for (vma = 
> > mm->mmap; vma; vma = vma->vm_next) {
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1505 switch 
> > (behaviour) {
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1506 
> > case MADV_MERGEABLE:
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1507 
> > ret = ksm_madvise_merge(vma->vm_mm, vma, >vm_flags);
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1508 
> > break;
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1509 
> > case MADV_UNMERGEABLE:
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1510 
> > ret = ksm_madvise_unmerge(vma, vma->vm_start, vma->vm_end, 
> > >vm_flags);
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1511 
> > break;
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1512 
> > default:
> > 930581120060a7 Oleksandr Natalenko 2021-10-04  1513 
> > /* look, ma, no brain */
> > 
> > ret = -EINVAL;?
> 
> I think whatever performs this check and complains is overly cautious because 
> given 1464–1472 `switch` block the value of `behaviour` cannot be anything 
> else other than `MADV_MERGEABLE | MADV_UNMERGEABLE`, hence `default` branch 
> will never be taken.
> 
> I can add this "fix", of course, to shut up the checker, but it doesn't make 
> much sense from my PoV.
> 
> A more reasonable thing to do is to remove `default` branch. Is this 
> something that can be tested by the test suite?
> 

You know what, I should have just looked at the date and ignored this.
My own test system does not complain about this, because it has cross
function information so it knows that default is impossible.

My bad.  Just ignore this.  To human reading this code it's pretty clear
from the comments that the default path is just about silencing static
checker warnings.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/irqchip/irq-apple-aic.c:941 aic_of_ic_init() error: uninitialized symbol 'off'.

2022-06-06 Thread Dan Carpenter
On Mon, Jun 06, 2022 at 12:16:22PM +0100, Marc Zyngier wrote:
> > dc97fd6fec0099 Hector Martin 2022-03-10   926   switch 
> > (irqc->info.version) {
> > dc97fd6fec0099 Hector Martin 2022-03-10   927   case 1: {
> > dc97fd6fec0099 Hector Martin 2022-03-10   928   u32 info;
> > dc97fd6fec0099 Hector Martin 2022-03-10   929  
> > 76cde26394114f Hector Martin 2021-01-21   930   info = 
> > aic_ic_read(irqc, AIC_INFO);
> > 7c841f5f6fa3f9 Hector Martin 2022-03-10   931   irqc->nr_irq = 
> > FIELD_GET(AIC_INFO_NR_IRQ, info);
> > dc97fd6fec0099 Hector Martin 2022-03-10   932   irqc->max_irq = 
> > AIC_MAX_IRQ;
> > dc97fd6fec0099 Hector Martin 2022-03-10   933  
> > dc97fd6fec0099 Hector Martin 2022-03-10   934   off = 
> > irqc->info.target_cpu;
> > dc97fd6fec0099 Hector Martin 2022-03-10   935   off += 
> > sizeof(u32) * irqc->max_irq; /* TARGET_CPU */
> > dc97fd6fec0099 Hector Martin 2022-03-10   936  
> > dc97fd6fec0099 Hector Martin 2022-03-10   937   break;
> > 
> > "off" uninitialized if irqc->info.version != 1.
> 
> Which is pretty much impossible by construction, as as of this
> particular commit, all the possible implementations have version == 1.
> 
> Subsequent patches do add cases where version == 2, and that gets
> covered too.
> 
> So unless I'm missing something obvious, there is no bug here.

I assumed it was something like that.  The kbuild bot doesn't do cross
function analysis.  Neither does Clang really.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1433 amdgpu_discovery_get_vcn_info() error: buffer overflow 'adev->vcn.vcn_codec_disable_mask' 2 <= 3

2022-06-02 Thread Dan Carpenter
On Thu, Jun 02, 2022 at 10:24:58AM -0400, Alex Deucher wrote:
> On Thu, Jun 2, 2022 at 7:51 AM Dan Carpenter  wrote:
> >
> > On Thu, Jun 02, 2022 at 08:26:03AM +0200, Ernst Sjöstrand wrote:
> > > Dan: I also ran Smatch which resulted in the following discussion:
> > >
> > > https://lists.freedesktop.org/archives/amd-gfx/2022-May/079228.html 
> >
> > Since the bounds check is dead code which does not make sense and is not
> > required, another idea would be to just delete it.
> 
> It wouldn't be dead code if AMDGPU_MAX_VCN_INSTANCES ever increased.

Or we could add a comment to the code I suppose.

/* Impossible in 2022 but this check might sense in the future */

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1433 amdgpu_discovery_get_vcn_info() error: buffer overflow 'adev->vcn.vcn_codec_disable_mask' 2 <= 3

2022-06-02 Thread Dan Carpenter
On Thu, Jun 02, 2022 at 08:26:03AM +0200, Ernst Sjöstrand wrote:
> Dan: I also ran Smatch which resulted in the following discussion:
> 
> https://lists.freedesktop.org/archives/amd-gfx/2022-May/079228.html 

Since the bounds check is dead code which does not make sense and is not
required, another idea would be to just delete it.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1433 amdgpu_discovery_get_vcn_info() error: buffer overflow 'adev->vcn.vcn_codec_disable_mask' 2 <= 3

2022-05-27 Thread Dan Carpenter
On Fri, May 27, 2022 at 07:56:48AM +, Chen, Guchun wrote:
> A patch was available already to protect against such scenario.
> 
> https://patchwork.freedesktop.org/patch/486289/ , "drm/amdgpu/discovery: 
> validate VCN and SDMA instances"
> 

What?  That's an unrelated patch and it has already been applied so I
took it into consideration when doing my analysis.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [kbuild-all] Re: [linux-next:master 408/8237] drivers/net/wireless/ath/ath11k/wow.c:712 ath11k_wow_op_resume() warn: inconsistent returns '>conf_mutex'.

2022-05-06 Thread Dan Carpenter
On Fri, May 06, 2022 at 05:58:22PM +0800, Chen, Rong A wrote:
> 
> 
> On 5/6/2022 4:46 PM, Kalle Valo wrote:
> > Dan Carpenter  writes:
> > 
> > > On Thu, May 05, 2022 at 09:29:40AM +0800, Carl Huang wrote:
> > > > Hi Kalle,
> > > > 
> > > > Is the below the same fix that you have already applied to ath.git?
> > > > 
> > > > [-next] ath11k: fix missing unlock on error in ath11k_wow_op_resume() -
> > > > Patchwork (kernel.org)
> > > > <https://patchwork.kernel.org/project/linux-wireless/patch/20220408030912.3087293-1-yangyingli...@huawei.com/
> > > > > 
> > > 
> > > That looks good.  It's sort of annoying for me to send a bug report a
> > > month after the fix has been applied...  Sorry about that.
> > 
> > My ath.git tree is not included in linux-wireless builds so there's also
> > a delay before linux-next sees the fix.
> 
> Hi,
> 
> Sorry for the overdue report , we'll take a look to prevent the same
> problem arising again.
> 
> > 
> > > 1) These are kbuild warnings.  The zero day bot generates the
> > > warnings and I look them over and hit send.  I don't know why the kbuild
> > > bot seems to get confused by -mm.  The subject says 408/8237 which is
> > > pretty crazy.  Maybe I should just ignore the -mm patches?
> > 
> > Yeah, I have been also wondering about using -mm for ath11k reports.
> > Does anyone know why that's happening?
> 
> We don't have a filter to ignore some warnings from specific branches,
> we can create one to only report ath11k issues if found in ath.git,
> please remind me if there are other rules.
> 

The problem is really specific to the -mm tree.  They always have
look like they're a part of a 1000+ series of patches.  There was another
one today:

[kbuild] [linux-next:master 5904/9357] kernel/bpf/verifier.c:5331 
process_kptr_func() warn: passing zero to 'PTR_ERR'

That warning is a false positive but a high quality false positive.
A lot of the "passing valid pointers" to PTR_ERR() bugs are caused
because Smatch thinks some arches have signed pointers.  I'm not sure
what's up with that...  :/  My bad.  Those are on me.

> > 
> > > 2) The blamed patch came from a git tree but it had a Link tag to
> > > lore.kernel.org so we could have used that as an In-Reply-to tag.
> > > In an ideal world, all the bug reports for a patch would go to a
> > > standard location.
> > > 
> > > Link:
> > > https://lore.kernel.org/r/1644308006-22784-5-git-send-email-quic_cjhu...@quicinc.com
> > 
> > Yeah, that would be nice.
> 
> We have already linked the bug reports to the patch if the patch hasn't
> been applied, I'm not sure is it possible to find the link of patch if
> it's already applied in a branch.

You could git do:

git show 90bf5c8d0f7ecddf96fc1cd9434af4e157b51970 | grep "Link: 
https://lore.kernel.org/r/;

Some of the links are to freedesktop which also has the msgid.

Link: 
https://patchwork.freedesktop.org/patch/msgid/20220504090229.2506560-1-l.st...@pengutronix.de

We're really trying to discourage links to other websites because it's
not under our control and it will break.  And you wouldn't have the CC
list either...  But I still think it's useful.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] uninitialized variables bugs

2022-05-06 Thread Dan Carpenter
Ever since commit 78a5255ffb6a ("Stop the ad-hoc games with
-Wno-maybe-initialized"), GCC's uninitialized variable warnings have
been disabled by default.  Now, you have to turn on W=1 or W=2 to see
the warnings which nobody except Arnd does.

Disabling that has lead to a bunch of embarrassing bugs where variables
are *never* initialized.  Very unsubtle bugs.  The bugs doesn't reach
users because Nathan Chancellor and I review Clang and Smatch warnings
respectively.  Also the kbuild-bot reports uninitialized variables.

It's a lot to deal with.  Uninitialized variable bugs are probably the
most common bug I have to deal with.

It's frustrating.  Sometimes the false positives are hard to analyse
because I have to read through multiple functions.  A lot of times
when I write a patch and a commit message Nathan has already fixed it
so it's just a waste of time.

It's risky as well.  The Smatch check for uninitialized variables was
broken for most of 2021.  Nathan sometimes goes on vacation.

I guess I would hope that one day we can turn on the GCC uninitialized
variable warnings again.  That would mean silencing false positives
which a lot of people don't want to do...  Maybe Clang has fewer false
positives than GCC?

The Smatch check for uninitialized variable was deliberately written to
be more strict than GCC because GCC was missing bugs.  So I think
leaving Smatch false positives is fine.  There is a trade off between
fewer false positives and missing bugs and Smatch is meant to err on the
side of finding bugs but with the cost of false positives.

Most of the Smatch uninitialized false positives are caused by loops:

int i, ret;

for (i = 0; i < bytes; i++) { // <-- what if bytes is zero?
if (...)
continue; // <-- can every iteration hit continue?
ret = frob();
}

return ret;

There is also stuff like this which is harmless:

uint val;

ret = read();
*p = val;  // <-- uninitialized variable if read() fails
return ret;

Btw, here is how to run Smatch on your code:
https://staticthinking.wordpress.com/2022/04/25/how-to-run-smatch-on-your-code/

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [linux-next:master 408/8237] drivers/net/wireless/ath/ath11k/wow.c:712 ath11k_wow_op_resume() warn: inconsistent returns '>conf_mutex'.

2022-05-04 Thread Dan Carpenter
On Thu, May 05, 2022 at 09:29:40AM +0800, Carl Huang wrote:
> Hi Kalle,
> 
> Is the below the same fix that you have already applied to ath.git?
> 
> [-next] ath11k: fix missing unlock on error in ath11k_wow_op_resume() -
> Patchwork (kernel.org) 
> <https://patchwork.kernel.org/project/linux-wireless/patch/20220408030912.3087293-1-yangyingli...@huawei.com/
> >

That looks good.  It's sort of annoying for me to send a bug report a
month after the fix has been applied...  Sorry about that.

1) These are kbuild warnings.  The zero day bot generates the
warnings and I look them over and hit send.  I don't know why the kbuild
bot seems to get confused by -mm.  The subject says 408/8237 which is
pretty crazy.  Maybe I should just ignore the -mm patches?

2) The blamed patch came from a git tree but it had a Link tag to
lore.kernel.org so we could have used that as an In-Reply-to tag.
In an ideal world, all the bug reports for a patch would go to a
standard location.

Link: 
https://lore.kernel.org/r/1644308006-22784-5-git-send-email-quic_cjhu...@quicinc.com

3) Another idea is that the kbuild bot could search lore for Fixes to
the original commit and include links to those threads?

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: net/dsa/tag_sja1105.c:432 sja1105_rcv() error: uninitialized symbol 'vid'.

2022-04-27 Thread Dan Carpenter
On Wed, Apr 27, 2022 at 03:17:55PM +, Vladimir Oltean wrote:
> On Wed, Apr 27, 2022 at 05:28:39PM +0300, Dan Carpenter wrote:
> > I should probably have wondered why I hadn't emailed you before...  For
> > some reason I got confused and thought it was an arch/ thing...
> > 
> > My desktop build does cross function analysis so it doesn't print this
> > false positive.
> > 
> > regards,
> > dan carpenter
> 
> So I don't need to do anything? Cool.

Yeah.  It's fine.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: net/dsa/tag_sja1105.c:432 sja1105_rcv() error: uninitialized symbol 'vid'.

2022-04-27 Thread Dan Carpenter
On Wed, Apr 27, 2022 at 01:51:28PM +, Vladimir Oltean wrote:
> On Wed, Apr 27, 2022 at 10:13:30AM +0300, Dan Carpenter wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  
> > master
> > head:   cf424ef014ac30b0da27125dd1fbdf10b0d3a520
> > commit: 04a1758348a87eb73b8a4554d0c227831e2bb33e net: dsa: tag_sja1105: fix 
> > control packets on SJA1110 being received on an imprecise port
> > config: openrisc-randconfig-m031-20220425 
> > (https://download.01.org/0day-ci/archive/20220427/202204270649.eun9p40c-...@intel.com/config
> >  )
> > compiler: or1k-linux-gcc (GCC) 11.2.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> > 
> > New smatch warnings:
> > net/dsa/tag_sja1105.c:432 sja1105_rcv() error: uninitialized symbol 'vid'.
> > 
> > Old smatch warnings:
> > net/dsa/tag_sja1105.c:564 sja1110_rcv() error: uninitialized symbol 'vid'.
> > 
> > vim +/vid +432 net/dsa/tag_sja1105.c
> > 
> > 227d07a07ef1262 Vladimir Oltean 2019-05-05  393  static struct sk_buff 
> > *sja1105_rcv(struct sk_buff *skb,
> > 227d07a07ef1262 Vladimir Oltean 2019-05-05  394 
> >struct net_device *netdev,
> > 227d07a07ef1262 Vladimir Oltean 2019-05-05  395 
> >struct packet_type *pt)
> > 227d07a07ef1262 Vladimir Oltean 2019-05-05  396  {
> > 884be12f85666c6 Vladimir Oltean 2021-07-26  397 int source_port = -1, 
> > switch_id = -1;
> > e53e18a6fe4d3ae Vladimir Oltean 2019-06-08  398 struct sja1105_meta 
> > meta = {0};
> > e80f40cbe4dd513 Vladimir Oltean 2020-03-24  399 struct ethhdr *hdr;
> > 42824463d38d273 Vladimir Oltean 2019-06-08  400 bool is_link_local;
> > e53e18a6fe4d3ae Vladimir Oltean 2019-06-08  401 bool is_meta;
> > 884be12f85666c6 Vladimir Oltean 2021-07-26  402 u16 vid;
> > 227d07a07ef1262 Vladimir Oltean 2019-05-05  403  
> > e80f40cbe4dd513 Vladimir Oltean 2020-03-24  404 hdr = eth_hdr(skb);
> > 42824463d38d273 Vladimir Oltean 2019-06-08  405 is_link_local = 
> > sja1105_is_link_local(skb);
> > e53e18a6fe4d3ae Vladimir Oltean 2019-06-08  406 is_meta = 
> > sja1105_is_meta_frame(skb);
> > 227d07a07ef1262 Vladimir Oltean 2019-05-05  407  
> > 227d07a07ef1262 Vladimir Oltean 2019-05-05  408 skb->offload_fwd_mark = 
> > 1;
> > 227d07a07ef1262 Vladimir Oltean 2019-05-05  409  
> > 233697b3b3f60b1 Vladimir Oltean 2021-06-11  410 if 
> > (sja1105_skb_has_tag_8021q(skb)) {
> > 42824463d38d273 Vladimir Oltean 2019-06-08  411 /* Normal 
> > traffic path. */
> > 04a1758348a87eb Vladimir Oltean 2021-07-29  412 
> > sja1105_vlan_rcv(skb, _port, _id, );
> > 
> > There is a return where *vid is not set
> 
> And also one where source_port and switch_id are left with their default
> values of -1.
> 

I should probably have wondered why I hadn't emailed you before...  For
some reason I got confused and thought it was an arch/ thing...

My desktop build does cross function analysis so it doesn't print this
false positive.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [krzk-github:n/qcom-ufs-opp-v2 14/16] drivers/opp/core.c:1215 dev_pm_opp_set_rate() error: uninitialized symbol 'ret'.

2022-04-15 Thread Dan Carpenter
On Fri, Apr 15, 2022 at 09:45:47AM +0300, Dan Carpenter wrote:
> tree:   https://github.com/krzk/linux n/qcom-ufs-opp-v2
> head:   bf7d30c9329c87f06dff42b303a9bcfd2e1f54eb
> commit: be46c855d54f763bfb95424e5204fe7496e2ee5f [14/16] PM: opp: allow 
> control of multiple clocks
> config: i386-randconfig-m021 
> (https://download.01.org/0day-ci/archive/20220415/202204150900.qnjmf3gu-...@intel.com/config)
> compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot 
> Reported-by: Dan Carpenter 
> 
> New smatch warnings:
> drivers/opp/core.c:1215 dev_pm_opp_set_rate() error: uninitialized symbol 
> 'ret'.
> 

This one is the warning I meant to include.

> Old smatch warnings:
> drivers/opp/core.c:1197 dev_pm_opp_set_rate() warn: passing a valid pointer 
> to 'PTR_ERR'
> drivers/opp/core.c:2813 _opp_set_availability() warn: passing a valid pointer 
> to 'PTR_ERR'
> drivers/opp/core.c:2884 dev_pm_opp_adjust_voltage() warn: passing a valid 
> pointer to 'PTR_ERR'

Sorry, these are false positives.  It comes from Smatch thinking
pointers are signed on certain arches.  I've been too lazy to set up a
cross compile system to debug the issue, but I really need to do that.  :/

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH v4 3/5] usb: gadget: add trace event of configfs group operation

2022-04-05 Thread Dan Carpenter
On Tue, Apr 05, 2022 at 01:54:09AM +, Linyu Yuan (QUIC) wrote:
> > From: Dan Carpenter 
> > Sent: Monday, April 4, 2022 2:36 PM
> > To: kbuild@lists.01.org; Linyu Yuan (QUIC) ;
> > Felipe Balbi ; Greg Kroah-Hartman
> > 
> > Cc: l...@intel.com; kbuild-...@lists.01.org; linux-...@vger.kernel.org; Jack
> > Pham (QUIC) ; Linyu Yuan (QUIC)
> > 
> > Subject: [kbuild] Re: [PATCH v4 3/5] usb: gadget: add trace event of 
> > configfs
> > group operation
> > 
> > Hi Linyu,
> > 
> > url:https://github.com/intel-lab-lkp/linux/commits/Linyu-Yuan/usb- 
> > gadget-configfs-new-trace-events/20220330-141926
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git   
> > usb-
> > testing
> > config: x86_64-randconfig-m001 (https://download.01.org/0day- 
> > ci/archive/20220331/202203311137.r3nm4dyz-...@intel.com/config )
> > compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> Thanks for report this issue, I will fix it,
> As this series are new files and still not approve,
> I don't know is it possible to add Reported-by tag ?

These are auto generated form letters.  I just read it and hit forward.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [djwong-xfs:djwong-wtf 349/351] fs/xfs/xfs_bmap_util.c:1372 xfs_map_free_extent() warn: missing error code 'error'

2022-03-24 Thread Dan Carpenter
On Tue, Mar 22, 2022 at 09:38:27AM -0700, Darrick J. Wong wrote:
> On Tue, Mar 22, 2022 at 08:47:26AM +0300, Dan Carpenter wrote:
> > On Mon, Mar 21, 2022 at 02:59:08PM -0700, Darrick J. Wong wrote:
> > > On Mon, Mar 21, 2022 at 10:33:02AM +0300, Dan Carpenter wrote:
> > > > b82670045aab66 Darrick J. Wong 2022-01-06  1365  
> > > > b82670045aab66 Darrick J. Wong 2022-01-06  1366 error = 
> > > > xfs_alloc_find_freesp(tp, pag, cursor, end_agbno, );
> > > > b82670045aab66 Darrick J. Wong 2022-01-06  1367 if (error)
> > > > b82670045aab66 Darrick J. Wong 2022-01-06  1368 goto 
> > > > out_cancel;
> > > > b82670045aab66 Darrick J. Wong 2022-01-06  1369  
> > > > b82670045aab66 Darrick J. Wong 2022-01-06  1370 /* Bail out if 
> > > > the cursor is beyond what we asked for. */
> > > > b82670045aab66 Darrick J. Wong 2022-01-06  1371 if (*cursor >= 
> > > > end_agbno)
> > > > b82670045aab66 Darrick J. Wong 2022-01-06 @1372 goto 
> > > > out_cancel;
> > > > 
> > > > This looks like it should have an error = -EINVAL;
> > > 
> > > Nope.  If xfs_alloc_find_freesp moves @cursor goes beyond end_agbno, we
> > > want to exit early so that the xfs_map_free_extent caller will return to
> > > userspace.
> > > 
> > > --D
> > 
> > I'm generally pretty happy with this static checker rule.  Returning
> > success on a failure path almost always results if something bad like a
> > NULL deref or a use after free.  But false positives are a real risk
> > because it's tempting to add an error code to this and introduce a bug.
> > 
> > Smatch will not print the warning if error is set within 4 lines of the
> > goto.
> > error = 0;
> > if (*cursor >= end_agbno)
> > goto out_cancel;
> 
> The trouble is, if I do that:
> 
>   error = xfs_alloc_find_freesp(...);
>   if (error)
>   goto out_cancel;
> 
>   error = 0;
>   if (*cursor >= end_agbno)
>   goto out_cancel;
> 
> then I'll get patch reviewers and/or tools complaining about setting
> error to zero unnecessarily.

Currently nothing would complain.  What causes complaints if the
assignments are not used.  Places where we assign a value and then
immediately re-assign over it.

It would only take a few minutes to write a checker rule which would
complain about assigning "ret = 0;" if we already know that foo was
zero, but hopefully no one will write it.

The closest is that Christophe JAILLET has a script to remove
duplicative memset()s to zero.

> Either way we end up with a lot of code
> golf for something the compiler will probably remove for us.
> 
> Question: Can sparse detect that the if() test involves a comparison
> between a non-pointer function argument and a dereferenced pointer
> argument?  Would that be sufficient to detect functions that advance a
> cursor passed in by the caller and return early when the cursor moves
> outside of a range also specified by the caller?

This is a Smatch test (not Sparse).  Smatch doesn't have code to
detect/describe that right now...  I'm not sure if the heuristic is very
useful.  I will look at future false positives and see if it applies.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [linux-next:master 8752/11953] sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR'

2022-03-22 Thread Dan Carpenter
On Tue, Mar 22, 2022 at 07:32:16PM +0530, Srinivasa Rao Mandadapu wrote:
> 
> On 3/22/2022 7:24 PM, Dan Carpenter wrote:
> Thanks for Your Time Dan!!!
> > On Tue, Mar 22, 2022 at 07:03:23PM +0530, Srinivasa Rao Mandadapu wrote:
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  14  struct 
> > > > lpass_macro *lpass_macro_pds_init(struct device *dev)
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  15  {
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  16  struct 
> > > > lpass_macro *l_pds;
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  17  int ret;
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  18
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  19  if 
> > > > (!of_find_property(dev->of_node, "power-domains", NULL))
> > > > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  20  
> > > > return NULL;
> > > > 
> > > > Returning NULL here will lead to a crash in tx_macro_runtime_resume()
> > > > 
> > > > When a function returns a mix of NULL and error pointers, then NULL
> > > > means the feature is deliberately disabled.  It's not an error, it's a
> > > > deliberate choice by the distro or sys admin.  The caller has to
> > > > be written to allow the feature to be disabled.
> > > > 
> > > > An example of this might be LEDs.  Maybe people don't want LEDs so code
> > > > has to asume that the led->ops pointer might be NULL and check for that
> > > > before dereferencing it.
> > > Actually, it's optional here. For some targets, with lpass ADSP enabled,
> > > power domains are not required.
> > > 
> > > So is the reason, returning NULL Here.
> > > 
> > Unfortunately, the caller is not written to handle NULLs so it will
> > crash.
> 
> Yes agree. will add error check with in lpass_macro_pds_exit().
> 
> Will that make sense?

Yep.  Thanks!

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [linux-next:master 8752/11953] sound/soc/codecs/lpass-macro-common.c:53 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR'

2022-03-22 Thread Dan Carpenter
On Tue, Mar 22, 2022 at 07:03:23PM +0530, Srinivasa Rao Mandadapu wrote:
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  14  struct lpass_macro 
> > *lpass_macro_pds_init(struct device *dev)
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  15  {
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  16  struct 
> > lpass_macro *l_pds;
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  17  int ret;
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  18
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  19  if 
> > (!of_find_property(dev->of_node, "power-domains", NULL))
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  20  return 
> > NULL;
> > 
> > Returning NULL here will lead to a crash in tx_macro_runtime_resume()
> > 
> > When a function returns a mix of NULL and error pointers, then NULL
> > means the feature is deliberately disabled.  It's not an error, it's a
> > deliberate choice by the distro or sys admin.  The caller has to
> > be written to allow the feature to be disabled.
> > 
> > An example of this might be LEDs.  Maybe people don't want LEDs so code
> > has to asume that the led->ops pointer might be NULL and check for that
> > before dereferencing it.
> 
> Actually, it's optional here. For some targets, with lpass ADSP enabled,
> power domains are not required.
> 
> So is the reason, returning NULL Here.
> 

Unfortunately, the caller is not written to handle NULLs so it will
crash.

sound/soc/codecs/lpass-tx-macro.c
  1913  static int tx_macro_remove(struct platform_device *pdev)
  1914  {
  1915  struct tx_macro *tx = dev_get_drvdata(>dev);
  1916  
  1917  clk_disable_unprepare(tx->macro);
  1918  clk_disable_unprepare(tx->dcodec);
  1919  clk_disable_unprepare(tx->mclk);
  1920  clk_disable_unprepare(tx->npl);
  1921  clk_disable_unprepare(tx->fsgen);
  1922  
  1923  lpass_macro_pds_exit(tx->pds);
 ^^^
Boom.

  1924  
  1925  return 0;
  1926  }


> > 
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  21
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  22  l_pds = 
> > devm_kzalloc(dev, sizeof(*l_pds), GFP_KERNEL);
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  23  if (!l_pds)
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  24  return 
> > ERR_PTR(-ENOMEM);
> > 
> > Good.
> > 
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  25
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  26  l_pds->macro_pd 
> > = dev_pm_domain_attach_by_name(dev, "macro");
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  27  if 
> > (IS_ERR_OR_NULL(l_pds->macro_pd))
> > 9e3d83c52844f95 Srinivasa Rao Mandadapu 2022-02-26  28  return 
> > NULL;
> > 
> > If this feature is optional then it should be:
> > 
> > if (IS_ERR_OR_NULL(l_pds->macro_pd))
> > return ERR_CAST(l_pds->macro_pd);
> > 
> > The admin deliberately chose to enable the feature so we can't just
> > ignore errors and convert them to NULL.
> 
> Here it's not optional, if power domains feature is available then macro and
> dcodec power domains should be present.
> 
> So will update it like below.
> 
>   if (IS_ERR_OR_NULL(l_pds->macro_pd)) {
>   ret = PTR_ERR(l_pds->macro_pd);
>   goto macro_err;
>   }

I bet COMPILE_TEST allows this to compile without CONFIG_PM but there
isn't anything we can do about that...

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [djwong-xfs:djwong-wtf 349/351] fs/xfs/xfs_bmap_util.c:1372 xfs_map_free_extent() warn: missing error code 'error'

2022-03-21 Thread Dan Carpenter
On Mon, Mar 21, 2022 at 02:59:08PM -0700, Darrick J. Wong wrote:
> On Mon, Mar 21, 2022 at 10:33:02AM +0300, Dan Carpenter wrote:
> > b82670045aab66 Darrick J. Wong 2022-01-06  1365  
> > b82670045aab66 Darrick J. Wong 2022-01-06  1366 error = 
> > xfs_alloc_find_freesp(tp, pag, cursor, end_agbno, );
> > b82670045aab66 Darrick J. Wong 2022-01-06  1367 if (error)
> > b82670045aab66 Darrick J. Wong 2022-01-06  1368 goto out_cancel;
> > b82670045aab66 Darrick J. Wong 2022-01-06  1369  
> > b82670045aab66 Darrick J. Wong 2022-01-06  1370 /* Bail out if the 
> > cursor is beyond what we asked for. */
> > b82670045aab66 Darrick J. Wong 2022-01-06  1371 if (*cursor >= 
> > end_agbno)
> > b82670045aab66 Darrick J. Wong 2022-01-06 @1372 goto out_cancel;
> > 
> > This looks like it should have an error = -EINVAL;
> 
> Nope.  If xfs_alloc_find_freesp moves @cursor goes beyond end_agbno, we
> want to exit early so that the xfs_map_free_extent caller will return to
> userspace.
> 
> --D

I'm generally pretty happy with this static checker rule.  Returning
success on a failure path almost always results if something bad like a
NULL deref or a use after free.  But false positives are a real risk
because it's tempting to add an error code to this and introduce a bug.

Smatch will not print the warning if error is set within 4 lines of the
goto.
error = 0;
if (*cursor >= end_agbno)
goto out_cancel;

Another option is that people have started adding comments to these
blocks in response to the checker warning.

Or if you had a different idea about how to silence the checker warning
I can also probably implement that.

regards,
dan carpenter

___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/net/ethernet/chelsio/cxgb4/sge.c:2571 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'

2022-03-10 Thread Dan Carpenter
On Thu, Mar 10, 2022 at 09:00:58AM +0100, Íñigo Huguet wrote:
> On Wed, Jul 7, 2021 at 9:37 AM Dan Carpenter  wrote:
> >
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  
> > master
> > head:   79160a603bdb51916226caf4a6616cc4e1c58a58
> > commit: 52bfcdd87e83d9e69d22da5f26b1512ffc81deed net:CXGB4: fix leak if 
> > sk_buff is not used
> > config: x86_64-randconfig-m001-20210706 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> >
> > New smatch warnings:
> > drivers/net/ethernet/chelsio/cxgb4/sge.c:2571 cxgb4_ethofld_send_flowc() 
> > warn: missing error code 'ret'
> 
> This was already reported here:
> https://lore.kernel.org/all/202107070458.fo35eqwu-...@intel.com/ 

To be honest, I saw that it was old, and I did wonder why the kbuild bot
was sending warnings from ancient code.

But at the same time, the code looked suspicious enough that I just
resent instead of investigating.  :P

With kbuild warnings, I always solemnly promise everyone that "These are
a one time email.  Feel free to ignore false positives."  Unfortunately
those promises are just lies to make people happy.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [linux-next:master 9388/11353] sound/soc/soc-compress.c:628 snd_soc_new_compress() error: we previously assumed 'codec_dai' could be null (see line 571)

2022-03-09 Thread Dan Carpenter
On Wed, Mar 09, 2022 at 05:32:19PM +0800, Jiasheng Jiang wrote:
> On Wed, Mar 09, 2022 at 01:58:04AM +0800, Dan Carpenter wrote:
> > smatch warnings:
> > sound/soc/soc-compress.c:628 snd_soc_new_compress() error: we previously 
> > assumed 'codec_dai' could be null (see line 571)
> 
> > de2c6f98817fa5d Jiasheng Jiang 2021-10-15 @571  if (codec_dai) {
> > 
> > Can codec_dai be NULL?  This new code assumes so.
> 
> > aeb6fa0f15c71a1 Peng Donglin   2017-08-16 @628  
> > rtd->dai_link->stream_name, codec_dai->name, num);
> > 
> > 
> > Unchecked dereference
> 
> Actually, if 'codec_dai' is NULL, the check in line 584 will fail and return 
> -EINVAL.
> 
> a1068045883ed4a Vinod Koul 2016-01-07  584if (playback + capture 
> != 1) {
> 141dfc9e3751f5f Charles Keepax 2018-01-26  585
> dev_err(rtd->card->dev,
> 141dfc9e3751f5f Charles Keepax 2018-01-26  586
> "Compress ASoC: Invalid direction for P %d, C %d\n",
> a1068045883ed4a Vinod Koul 2016-01-07  587
> playback, capture);
> a1068045883ed4a Vinod Koul 2016-01-07  588return -EINVAL;
> a1068045883ed4a Vinod Koul 2016-01-07  589}
> 

Yeah.  That's true.  Smatch tries to look at conditions and figure out
the implications but this one is too complicated.

But if codec_dai can really be NULL then it would be easier to
understand if we reversed the check on codec_dai and returned early.

if (!codec_dai) {
dev_err(rtd->card->dev, "Missing codec\n");
return -EINVAL;
}

/* check client and interface hw capabilities */
if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) &&
snd_soc_dai_stream_valid(cpu_dai,   SNDRV_PCM_STREAM_PLAYBACK))
playback = 1;

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [kdave-btrfs-devel:for-next-20220307 108/147] fs/btrfs/scrub.c:3146 scrub_raid56_data_stripe_for_parity() error: we previously assumed 'bioc' could be null (see line 3138)

2022-03-08 Thread Dan Carpenter
On Tue, Mar 08, 2022 at 04:09:54PM +0300, Dan Carpenter wrote:
> tree:   https://github.com/kdave/btrfs-devel.git for-next-20220307
> head:   912dedd70aeb485247c507115704ea7d137d758b
> commit: 80cd926eefca522182ee3cf04d8e9984073d34d1 [108/147] btrfs: refactor 
> scrub_raid56_parity()
> config: i386-randconfig-m021-20220307 
> (https://download.01.org/0day-ci/archive/20220308/202203081837.zottrqrn-...@intel.com/config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot 
> Reported-by: Dan Carpenter 
> 
> New smatch warnings:
> fs/btrfs/scrub.c:3171 scrub_raid56_data_stripe_for_parity() error: 
> uninitialized symbol 'extent_start'.
> fs/btrfs/scrub.c:3172 scrub_raid56_data_stripe_for_parity() error: 
> uninitialized symbol 'extent_size'.
> 
> Old smatch warnings:
> fs/btrfs/scrub.c:3419 scrub_simple_mirror() error: uninitialized symbol 'ret'.
> 
> vim +/bioc +3146 fs/btrfs/scrub.c
> 
> 093741d4cda2cb4 Qu Wenruo 2022-02-18  3021  
> 80cd926eefca522 Qu Wenruo 2022-02-18  3022  static int 
> scrub_raid56_data_stripe_for_parity(struct scrub_ctx *sctx,
> 80cd926eefca522 Qu Wenruo 2022-02-18  3023
>struct scrub_parity *sparity,
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3024
>struct map_lookup *map,
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3025
>struct btrfs_device *sdev,
> 80cd926eefca522 Qu Wenruo 2022-02-18  3026
>struct btrfs_path *path,
> 80cd926eefca522 Qu Wenruo 2022-02-18  3027
>u64 logical)
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3028  {
> fb456252d3d9c05 Jeff Mahoney  2016-06-22  3029struct btrfs_fs_info 
> *fs_info = sctx->fs_info;
> 80cd926eefca522 Qu Wenruo 2022-02-18  3030struct btrfs_root 
> *extent_root = btrfs_extent_root(fs_info, logical);
> 80cd926eefca522 Qu Wenruo 2022-02-18  3031struct btrfs_root 
> *csum_root = btrfs_csum_root(fs_info, logical);
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3032struct btrfs_key key;
> 80cd926eefca522 Qu Wenruo 2022-02-18  3033u64 extent_start;
> 80cd926eefca522 Qu Wenruo 2022-02-18  3034u64 extent_size;
> 80cd926eefca522 Qu Wenruo 2022-02-18  3035int ret;
> 2522dbe86b54ff0 Qu Wenruo 2021-12-14  3036  
> 80cd926eefca522 Qu Wenruo 2022-02-18  3037ASSERT(map->type & 
> BTRFS_BLOCK_GROUP_RAID56_MASK);
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3038  
> 80cd926eefca522 Qu Wenruo 2022-02-18  3039/* Path should not be 
> populated */
> 80cd926eefca522 Qu Wenruo 2022-02-18  3040ASSERT(!path->nodes[0]);
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3041  
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3042if 
> (btrfs_fs_incompat(fs_info, SKINNY_METADATA))
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3043key.type = 
> BTRFS_METADATA_ITEM_KEY;
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3044else
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3045key.type = 
> BTRFS_EXTENT_ITEM_KEY;
> 80cd926eefca522 Qu Wenruo 2022-02-18  3046key.objectid = logical;
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3047key.offset = (u64)-1;
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3048  
> 80cd926eefca522 Qu Wenruo 2022-02-18  3049ret = 
> btrfs_search_slot(NULL, extent_root, , path, 0, 0);
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3050if (ret < 0)
> 80cd926eefca522 Qu Wenruo 2022-02-18  3051return ret;
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3052  
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3053if (ret > 0) {
> 80cd926eefca522 Qu Wenruo 2022-02-18  3054ret = 
> btrfs_previous_extent_item(extent_root, path, 0);
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3055if (ret < 0)
> 80cd926eefca522 Qu Wenruo 2022-02-18  3056return 
> ret;
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3057if (ret > 0) {
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3058
> btrfs_release_path(path);
> 80cd926eefca522 Qu Wenruo 2022-02-18  3059ret = 
> btrfs_search_slot(NULL, extent_root, , path,
> 80cd926eefca522 Qu Wenruo 2022-02-18  3060
> 0, 0);
> 5a6ac9eacb49143 Miao Xie  2014-11-06  3061if (ret 
> < 0)
> 80cd926eefca522 Qu Wenruo 2022-02-18  3062

[kbuild] Re: [PATCH v3 2/2] serial: 8250: Add proper clock handling for OxSemi PCIe devices

2022-02-17 Thread Dan Carpenter
On Thu, Feb 17, 2022 at 12:05:58PM +, Maciej W. Rozycki wrote:
> On Thu, 17 Feb 2022, Dan Carpenter wrote:
> 
> > url:
> > https://github.com/0day-ci/linux/commits/Maciej-W-Rozycki/serial-8250-Fixes-for-Oxford-Semiconductor-950-UARTs/20220212-164255
> >  
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git  
> > tty-testing
> > config: x86_64-randconfig-m001 
> > (https://download.01.org/0day-ci/archive/20220213/202202130027.zkbcgtm5-...@intel.com/config
> >  )
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> > 
> > New smatch warnings:
> > drivers/tty/serial/8250/8250_pci.c:1171 pci_oxsemi_tornado_get_divisor() 
> > error: uninitialized symbol 'tcr'.
> > drivers/tty/serial/8250/8250_pci.c:1172 pci_oxsemi_tornado_get_divisor() 
> > error: uninitialized symbol 'quot'.
> > drivers/tty/serial/8250/8250_pci.c:1180 pci_oxsemi_tornado_get_divisor() 
> > error: uninitialized symbol 'cpr'.
> 
>  These variables do get assigned to in the first iteration of the loop, 
> because the deviation calculated (`srem') is normalised to the range of 
> [0,spre/2] and that divided by the original divisor (`spre') always works 
> out at within [0,0.5], so `squot' will be within [0,32768].  I guess the 
> static analyser is too dumb to figure it out, so I'll see how to paper it 
> over unless someone has a better proposal.

These emails are a one time email so it's okay to ignore them if you
want.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [ambarus:spi-nor/next 1/15] drivers/spi/atmel-quadspi.c:1202 atmel_qspi_dma_init() warn: passing zero to 'PTR_ERR'

2022-02-11 Thread Dan Carpenter
On Fri, Feb 11, 2022 at 08:30:48AM +, tudor.amba...@microchip.com wrote:
> On 2/11/22 10:04, Dan Carpenter wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
> > content is safe
> > 
> > tree:   https://github.com/ambarus/linux-0day  spi-nor/next
> > head:   038b3fa2d89f1a00fdb8767704cdb799a0fe746b
> > commit: ff51c966a3c5144ae964797349747e680ee47c3a [1/15] spi: atmel-quadspi: 
> > Add support for sama7g5 QSPI
> > config: openrisc-randconfig-m031-20220210 
> > (https://download.01.org/0day-ci/archive/20220211/202202110830.1ogwxrwt-...@intel.com/config
> >  )
> > compiler: or1k-linux-gcc (GCC) 11.2.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> > 
> > smatch warnings:
> > drivers/spi/atmel-quadspi.c:1202 atmel_qspi_dma_init() warn: passing zero 
> > to 'PTR_ERR'
> > 
> > vim +/PTR_ERR +1202 drivers/spi/atmel-quadspi.c
> > 
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1194  static int atmel_qspi_dma_init(struct spi_controller 
> > *ctrl)
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1195  {
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1196 struct atmel_qspi *aq = 
> > spi_controller_get_devdata(ctrl);
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1197 int ret;
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1198
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1199 aq->rx_chan = dma_request_chan(>pdev->dev, "rx");
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1200 if (IS_ERR(aq->rx_chan)) {
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1201 aq->rx_chan = NULL;
> > 
> > Need to preserve the error code before setting this to NULL
> > 
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19 @1202 return dev_err_probe(>pdev->dev, 
> > PTR_ERR(aq->rx_chan),
> > ff51c966a3c514 drivers/spi/atmel-quadspi.c Tudor Ambarus   
> > 2020-10-19  1203  "RX DMA channel is not 
> > available\n");
> > 
> > This will return success.
> > 
> 
> Indeed, thanks! This is a personal development branch, I'll fix it inline 
> since
> the patch that adds support for this has not been integrated in mainline yet.
> I'm not sure if I have to add the Reported-by tags or how to give credit to
> a bug spotted on a patch that has not yet landed in mainline. Maybe by adding
> a comment in the comments section of the patch "---"?

This is an automated email from the kbuild-bot.  Feel free to ignore it
when you want to.  I just look it over and hit the forward button.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: arch/powerpc/net/bpf_jit_comp.c:225 bpf_int_jit_compile() error: uninitialized symbol 'pass'.

2022-02-04 Thread Dan Carpenter
On Fri, Feb 04, 2022 at 02:24:50PM +, Christophe Leroy wrote:
> 
> 
> Le 04/02/2022 à 15:14, Dan Carpenter a écrit :
> > On Fri, Feb 04, 2022 at 01:18:24PM +, Christophe Leroy wrote:
> >> Hi Dan,
> >>
> >> Le 04/02/2022 à 11:37, Dan Carpenter a écrit :
> >>> tree:   
> >>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> >>> master
> >>> head:   88808fbbead481aedb46640a5ace69c58287f56a
> >>> commit: 51c66ad849a703d9bbfd7704c941827aed0fd9fd powerpc/bpf: Implement 
> >>> extended BPF on PPC32
> >>
> >> As far as I can see, it's been there long before that.
> >>
> >> Seems it comes from 025dceb0fab3 ("bpf: powerpc64: optimize JIT passes
> >> for bpf function calls")
> > 
> > These emails are auto generated by bot.  I just look over the email and
> > verify it looks reasonable.  Moving the code around sometimes makes it
> > show up as a new bug.  Also changes to the Kconfig file can affect which
> > code is checked.
> > 
> > The commit that you mention does not generate a warning.  The warning
> > started in commit 025dceb0fab3 ("bpf: powerpc64: optimize JIT passes for
> > bpf function calls").
> > 
> 
> ???
> 
> Didn't I mention commit 025dceb0fab3 ("bpf: powerpc64: optimize JIT 
> passes for bpf function calls") ?
> 

Oh...  I'm not sure what I was looking at.  :P  Must be time for me to
knock off for the weekend.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: arch/powerpc/net/bpf_jit_comp.c:225 bpf_int_jit_compile() error: uninitialized symbol 'pass'.

2022-02-04 Thread Dan Carpenter
On Fri, Feb 04, 2022 at 01:18:24PM +, Christophe Leroy wrote:
> Hi Dan,
> 
> Le 04/02/2022 à 11:37, Dan Carpenter a écrit :
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  
> >  master
> > head:   88808fbbead481aedb46640a5ace69c58287f56a
> > commit: 51c66ad849a703d9bbfd7704c941827aed0fd9fd powerpc/bpf: Implement 
> > extended BPF on PPC32
> 
> As far as I can see, it's been there long before that.
> 
> Seems it comes from 025dceb0fab3 ("bpf: powerpc64: optimize JIT passes 
> for bpf function calls")

These emails are auto generated by bot.  I just look over the email and
verify it looks reasonable.  Moving the code around sometimes makes it
show up as a new bug.  Also changes to the Kconfig file can affect which
code is checked.

The commit that you mention does not generate a warning.  The warning
started in commit 025dceb0fab3 ("bpf: powerpc64: optimize JIT passes for
bpf function calls").

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: kernel/trace/trace_events_hist.c:6174 event_hist_trigger_parse() error: we previously assumed 'glob' could be null (see line 6166)

2022-01-26 Thread Dan Carpenter
On Wed, Jan 26, 2022 at 09:39:18AM -0500, Steven Rostedt wrote:
> > 9ec5a7d16899ed Tom Zanussi 2022-01-10  6149  static int 
> > event_hist_trigger_parse(struct event_command *cmd_ops,
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6150 
> > struct trace_event_file *file,
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6151 
> > char *glob, char *cmd, char *param)
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6152  {
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6153 unsigned int 
> > hist_trigger_bits = TRACING_MAP_BITS_DEFAULT;
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6154 struct 
> > event_trigger_data *trigger_data;
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6155 struct 
> > hist_trigger_attrs *attrs;
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6156 struct 
> > event_trigger_ops *trigger_ops;
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6157 struct 
> > hist_trigger_data *hist_data;
> > 4b147936fa5096 Tom Zanussi 2018-01-15  6158 struct 
> > synth_event *se;
> > 4b147936fa5096 Tom Zanussi 2018-01-15  6159 const char 
> > *se_name;
> > 30350d65ac5676 Tom Zanussi 2018-01-15  6160 bool remove = 
> > false;
> > c5eac6ee8bc5d3 Kalesh Singh2021-10-25  6161 char *trigger, 
> > *p, *start;
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6162 int ret = 0;
> > 7ef224d1d0e3a1 Tom Zanussi 2016-03-03  6163  
> > 0e2b81f7b52a1c Masami Hiramatsu2018-11-05  6164 
> > lockdep_assert_held(_mutex);
> > 0e2b81f7b52a1c Masami Hiramatsu2018-11-05  6165  
> > f404da6e1d46ce Tom Zanussi 2018-01-15 @6166 if (glob && 
> > strlen(glob)) {
> 
> I just reviewed the code, and it looks like the logic should keep glob from
> ever being NULL.

Smatch can also figure that out, and does not warn, if you have the
cross function DB.  Unfortunately, that's not feasible for the zero day
bot because it takes too long to build the DB.

I was puzzled why this warning showed up now when the code is from 2018.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] [allisonhenderson-xfs-work:delayed_attrs_v26_extended 17/30] fs/xfs/libxfs/xfs_attr.c:666:46: warning: Expression '(X | 0x8) != 0x0' is always true. [comparisonError]

2022-01-24 Thread Dan Carpenter
tree:   https://github.com/allisonhenderson/xfs_work.git  
delayed_attrs_v26_extended
head:   19459f5cfa422b0a6a9cd3898892e43ecb49f8f3
commit: 721a69ffe0e2561371de01822bef355354eee926 [17/30] xfs: add parent 
pointer support to attribute code
compiler: sparc64-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> fs/xfs/libxfs/xfs_attr.c:666:46: warning: Expression '(X | 0x8) != 0x0' is 
>> always true. [comparisonError]
rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;
^

vim +666 fs/xfs/libxfs/xfs_attr.c

c5b4ac39a4cb6a fs/xfs/xfs_attr.cChristoph Hellwig 2014-05-13  653  int
c5b4ac39a4cb6a fs/xfs/xfs_attr.cChristoph Hellwig 2014-05-13  654  
xfs_attr_set(
a25446224353a7 fs/xfs/libxfs/xfs_attr.c Christoph Hellwig 2020-02-26  655   
struct xfs_da_args  *args)
^1da177e4c3f41 fs/xfs/xfs_attr.cLinus Torvalds2005-04-16  656  {
a25446224353a7 fs/xfs/libxfs/xfs_attr.c Christoph Hellwig 2020-02-26  657   
struct xfs_inode*dp = args->dp;
3d3c8b5222b924 fs/xfs/xfs_attr.cJie Liu   2013-08-12  658   
struct xfs_mount*mp = dp->i_mount;
3d3c8b5222b924 fs/xfs/xfs_attr.cJie Liu   2013-08-12  659   
struct xfs_trans_restres;
721a69ffe0e256 fs/xfs/libxfs/xfs_attr.c Allison Henderson 2021-08-23  660   
boolrsvd;
4c74a56b9de76b fs/xfs/libxfs/xfs_attr.c Allison Henderson 2018-10-18  661   
int error, local;
3a19bb147c72d2 fs/xfs/libxfs/xfs_attr.c Chandan Babu R2021-01-22  662   
int rmt_blks = 0;
0eb81a5f5c3442 fs/xfs/libxfs/xfs_attr.c Christoph Hellwig 2020-02-26  663   
unsigned inttotal;
5fad9cb9d34c53 fs/xfs/libxfs/xfs_attr.c Allison Henderson 2022-01-18  664   
int delayed = xfs_has_larp(mp);
c5b4ac39a4cb6a fs/xfs/xfs_attr.cChristoph Hellwig 2014-05-13  665  
721a69ffe0e256 fs/xfs/libxfs/xfs_attr.c Allison Henderson 2021-08-23 @666   
rsvd = ((args->attr_filter & XFS_ATTR_ROOT) | XFS_ATTR_PARENT) != 0;

Anything ORed with XFS_ATTR_PARENT can't be zero.  Parentheses in the
wrong location?

rsvd = (args->attr_filter & (XFS_ATTR_ROOT | XFS_ATTR_PARENT)) != 0;

721a69ffe0e256 fs/xfs/libxfs/xfs_attr.c Allison Henderson 2021-08-23  667  
75c8c50fa16a23 fs/xfs/libxfs/xfs_attr.c Dave Chinner  2021-08-18  668   
if (xfs_is_shutdown(dp->i_mount))
2451337dd04390 fs/xfs/libxfs/xfs_attr.c Dave Chinner  2014-06-25  669   
return -EIO;
c5b4ac39a4cb6a fs/xfs/xfs_attr.cChristoph Hellwig 2014-05-13  670  
0eb81a5f5c3442 fs/xfs/libxfs/xfs_attr.c Christoph Hellwig 2020-02-26  671   
error = xfs_qm_dqattach(dp);
0eb81a5f5c3442 fs/xfs/libxfs/xfs_attr.c Christoph Hellwig 2020-02-26  672   
if (error)

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org 
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [kvalo-ath:pending 52/56] drivers/net/wireless/ath/ath11k/wmi.c:5651 ath11k_wmi_tlv_fw_stats_data_parse() error: uninitialized symbol 'len'.

2022-01-11 Thread Dan Carpenter
On Tue, Jan 11, 2022 at 03:35:26PM +0200, Kalle Valo wrote:
> > bc5c448b70ff14 Wen Gong 2021-12-08 5629 static int
> > ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab,
> > bc5c448b70ff14 Wen Gong 2021-12-08 5630 struct wmi_tlv_fw_stats_parse
> > *parse,
> > bc5c448b70ff14 Wen Gong 2021-12-08 5631 const void *ptr)
> > bc5c448b70ff14 Wen Gong   2021-12-08  5632  {
> > bc5c448b70ff14 Wen Gong 2021-12-08 5633 struct ath11k_fw_stats *stats
> > = parse->stats;
> > bc5c448b70ff14 Wen Gong 2021-12-08 5634 const struct wmi_stats_event
> > *ev = parse->ev;
> > bc5c448b70ff14 Wen Gong   2021-12-08  5635  int i;
> > bc5c448b70ff14 Wen Gong   2021-12-08  5636  const void *data = ptr;
> > bc5c448b70ff14 Wen Gong   2021-12-08  5637  u32 len;

"len" is a local variable, not a parameter.

> > bc5c448b70ff14 Wen Gong   2021-12-08  5638  
> > bc5c448b70ff14 Wen Gong   2021-12-08  5639  if (!ev) {
> > bc5c448b70ff14 Wen Gong 2021-12-08 5640 ath11k_warn(ab, "failed to
> > fetch update stats ev");
> > bc5c448b70ff14 Wen Gong   2021-12-08  5641  return -EPROTO;
> > bc5c448b70ff14 Wen Gong   2021-12-08  5642  }
> > d5c65159f28953 Kalle Valo 2019-11-23  5643  
> > d5c65159f28953 Kalle Valo 2019-11-23  5644  stats->stats_id = 0;
> > d5c65159f28953 Kalle Valo 2019-11-23  5645  
> > d5c65159f28953 Kalle Valo 2019-11-23 5646 for (i = 0; i <
> > ev->num_pdev_stats; i++) {
> > d5c65159f28953 Kalle Valo 2019-11-23 5647 const struct wmi_pdev_stats
> > *src;
> > d5c65159f28953 Kalle Valo 2019-11-23 5648 struct ath11k_fw_stats_pdev
> > *dst;
> > d5c65159f28953 Kalle Valo 2019-11-23  5649  
> > d5c65159f28953 Kalle Valo 2019-11-23  5650  src = data;
> > bc5c448b70ff14 Wen Gong   2021-12-08 @5651  if (len < 
> > sizeof(*src))
> >
> > "len" is never initialized.
> 
> I only quickly looked at this, but AFAICS ath11k_wmi_tlv_iter() provides
> len to ath11k_wmi_tlv_fw_stats_parse() which again provides len to
> ath11k_wmi_tlv_fw_stats_data_parse(). I'm not seeing how this is
> uninitalised, did I miss something?

I think the bug was fixed and the tree was rebased?  I only look at the
email and hit forward and the code in the email was clearly buggy but
tree looks okay now as you say.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH bpf-next] Fix incorrect integer literal used for marking scratched registers in verifier logs

2022-01-11 Thread Dan Carpenter
On Mon, Jan 10, 2022 at 02:12:58PM -0800, Christy Lee wrote:
> On Mon, Jan 10, 2022 at 1:52 PM Song Liu  wrote:
> >
> > On Fri, Jan 7, 2022 at 4:59 PM Christy Lee  wrote:
> > >
> > > env->scratched_stack_slots is a 64-bit value, we should use ULL
> > > instead of UL literal values.
> > >
> > > Reported-by: kernel test robot 
> > > Reported-by: Dan Carpenter 
> > > Signed-off-by: Christy Lee 
> >
> > The fix looks good to me. Thus:
> >
> > Acked-by: Song Liu 
> >
> > However, the patch looks corrupted. Also, the subject is probably too
> > long (./scripts/checkpatch.pl should complain about it).
> >
> 
> I just checked that even with an absurdly long subject (more than 200
> characters), ./scripts/checkpatch.pl doesn't complain. It only complains
> when the commit message body has longer than 75 characters but not the
> subject line.  What's the maximum subject line length?
> 

People say 50 characters but that just seems more aspirational than
realistic.  This patch needs a subsystem prefix as well.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/firmware/arm_scmi/scmi_pm_domain.c:40 scmi_pd_power() error: uninitialized symbol 'ret_state'.

2021-12-08 Thread Dan Carpenter
On Wed, Dec 08, 2021 at 07:19:03PM +0800, kernel test robot wrote:
> CC: kbuild-...@lists.01.org
> CC: linux-ker...@vger.kernel.org
> TO: Arnd Bergmann 
> CC: Bjorn Andersson 
> CC: Charles Keepax 
> CC: Mark Brown 
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   2a987e65025e2b79c6d453b78cb5985ac6e5eb26
> commit: 951cd3a0866d29cb9c01ebc1d9c17590e598226e firmware: include 
> drivers/firmware/Kconfig unconditionally
> date:   9 weeks ago
> :: branch date: 12 hours ago
> :: commit date: 9 weeks ago
> config: arc-randconfig-m031-20211208 
> (https://download.01.org/0day-ci/archive/20211208/202112081921.snwphjs3-...@intel.com/config)
> compiler: arc-elf-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot 
> Reported-by: Dan Carpenter 
> 
> smatch warnings:
> drivers/firmware/arm_scmi/scmi_pm_domain.c:40 scmi_pd_power() error: 
> uninitialized symbol 'ret_state'.
> drivers/firmware/arm_scmi/scmi_pm_domain.c:95 scmi_pm_domain_probe() error: 
> uninitialized symbol 'ph'.

Sorry for all these uninitialized variable false positives.  I had
forgotten to commit something.  Fixed now.

regards,
dasn carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [chrome-os:chromeos-5.10 99/235] drivers/usb/typec/port-mapper.c:168 typec_link_port() warn: missing error code 'ret'

2021-12-07 Thread Dan Carpenter
On Tue, Dec 07, 2021 at 08:26:09AM -0800, Guenter Roeck wrote:
> On Tue, Dec 7, 2021 at 2:58 AM Dan Carpenter  wrote:
> > 98e43a40b551c9 Heikki Krogerus 2021-04-07  165
> > 98e43a40b551c9 Heikki Krogerus 2021-04-07  166  connector = 
> > find_connector(node);
> > 98e43a40b551c9 Heikki Krogerus 2021-04-07  167  if (!connector)
> > 98e43a40b551c9 Heikki Krogerus 2021-04-07 @168  goto 
> > remove_node;
> >
> > Should there be an error code on this path?
> >
> 
> Apparently not. See your upstream commit 434438d8f9d3 ("usb: typec:
> silence a static checker warning") which silences this warning.
> 

Lol.  And my commit message was so useless as well...  How did past me
know it was intentional?  But Heikki says it's right so it must be.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/net/can/usb/peak_usb/pcan_usb.c:523 pcan_usb_decode_error() error: we previously assumed 'cf' could be null (see line 503)

2021-12-03 Thread Dan Carpenter
On Fri, Dec 03, 2021 at 03:58:51PM +0100, Marc Kleine-Budde wrote:
> > 
> > 46be265d338833 Stephane Grosjean 2012-03-02  450  static int 
> > pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
> > 46be265d338833 Stephane Grosjean 2012-03-02  451
> >  u8 status_len)
> > 46be265d338833 Stephane Grosjean 2012-03-02  452  {
> > 46be265d338833 Stephane Grosjean 2012-03-02  453struct sk_buff *skb;
> > 46be265d338833 Stephane Grosjean 2012-03-02  454struct can_frame *cf;
> > c11dcee7583027 Stephane Grosjean 2021-07-15  455enum can_state 
> > new_state = CAN_STATE_ERROR_ACTIVE;
> > 46be265d338833 Stephane Grosjean 2012-03-02  456  
> > 46be265d338833 Stephane Grosjean 2012-03-02  457/* ignore this error 
> > until 1st ts received */
> > 46be265d338833 Stephane Grosjean 2012-03-02  458if (n == 
> > PCAN_USB_ERROR_QOVR)
> > 46be265d338833 Stephane Grosjean 2012-03-02  459if 
> > (!mc->pdev->time_ref.tick_count)
> > 46be265d338833 Stephane Grosjean 2012-03-02  460return 
> > 0;
> > 46be265d338833 Stephane Grosjean 2012-03-02  461  
> > c11dcee7583027 Stephane Grosjean 2021-07-15  462/* allocate an skb to 
> > store the error frame */
> > c11dcee7583027 Stephane Grosjean 2021-07-15  463skb = 
> > alloc_can_err_skb(mc->netdev, );
> 
> alloc_can_err_skb() ->
> alloc_canfd_skb()
> 
> https://elixir.bootlin.com/linux/v5.15/source/drivers/net/can/dev/skb.c#L210
> 
> If skb is NULL, cf is set to NULL, too.

Yeah.  Sorry about that.  The kbuild-bot doesn't do much cross function
analysis (none for functions that are not inline).  I saw that this
patch was old and could easily have checked it on my system which has
the cross function DB but I was in a rush.  :/  My bad.  Will try be a
more diligent person next time.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [linux-next:master 4042/4626] net/ceph/messenger_v2.c:311 alloc_conn_buf() error: kvmalloc() only makes sense with GFP_KERNEL

2021-12-03 Thread Dan Carpenter
The mm devs have modified vmalloc() to all GFP_NOIO.  It's only
GFP_ATOMIC and GFP_SLEEP which aren't allowed now.  I have pushed an
update for this.

regards,
dan carpenter

On Wed, Dec 01, 2021 at 11:26:46PM +0800, kernel test robot wrote:
> CC: kbuild-...@lists.01.org
> CC: Linux Memory Management List 
> TO: Michal Hocko 
> CC: "Uladzislau Rezki (Sony)" 
> CC: Andrew Morton 
> CC: Linux Memory Management List 
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
> master
> head:   048aeae86c3967f4c40666cd26f2c1eb73a4b805
> commit: 232323e9a580d6b34f3a513602b21359a79a09dd [4042/4626] mm: allow 
> !GFP_KERNEL allocations for kvmalloc
> :: branch date: 10 hours ago
> :: commit date: 2 days ago
> config: arm-randconfig-m031-20211128 
> (https://download.01.org/0day-ci/archive/20211201/202112012323.erlbotlt-...@intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot 
> Reported-by: Dan Carpenter 
> 
> New smatch warnings:
> net/ceph/messenger_v2.c:311 alloc_conn_buf() error: kvmalloc() only makes 
> sense with GFP_KERNEL
> net/ceph/osdmap.c:983 alloc_workspace() error: kvmalloc() only makes sense 
> with GFP_KERNEL
> net/ceph/osdmap.c:1193 osdmap_set_max_osd() error: kvmalloc() only makes 
> sense with GFP_KERNEL
> net/ceph/osdmap.c:1506 set_primary_affinity() error: kvmalloc() only makes 
> sense with GFP_KERNEL
> 
> Old smatch warnings:
> net/ceph/osdmap.c:1194 osdmap_set_max_osd() error: kvmalloc() only makes 
> sense with GFP_KERNEL
> net/ceph/osdmap.c:1195 osdmap_set_max_osd() error: kvmalloc() only makes 
> sense with GFP_KERNEL
> net/ceph/osdmap.c:1225 osdmap_set_max_osd() error: kvmalloc() only makes 
> sense with GFP_KERNEL
> 
> vim +311 net/ceph/messenger_v2.c
> 
> cd1a677cad9940 Ilya Dryomov 2020-11-19  301  
> cd1a677cad9940 Ilya Dryomov 2020-11-19  302  static void 
> *alloc_conn_buf(struct ceph_connection *con, int len)
> cd1a677cad9940 Ilya Dryomov 2020-11-19  303  {
> cd1a677cad9940 Ilya Dryomov 2020-11-19  304   void *buf;
> cd1a677cad9940 Ilya Dryomov 2020-11-19  305  
> cd1a677cad9940 Ilya Dryomov 2020-11-19  306   dout("%s con %p len %d\n", 
> __func__, con, len);
> cd1a677cad9940 Ilya Dryomov 2020-11-19  307  
> cd1a677cad9940 Ilya Dryomov 2020-11-19  308   if 
> (WARN_ON(con->v2.conn_buf_cnt >= ARRAY_SIZE(con->v2.conn_bufs)))
> cd1a677cad9940 Ilya Dryomov 2020-11-19  309   return NULL;
> cd1a677cad9940 Ilya Dryomov 2020-11-19  310  
> 232323e9a580d6 Michal Hocko 2021-11-30 @311   buf = kvmalloc(len, GFP_NOIO);
> cd1a677cad9940 Ilya Dryomov 2020-11-19  312   if (!buf)
> cd1a677cad9940 Ilya Dryomov 2020-11-19  313   return NULL;
> cd1a677cad9940 Ilya Dryomov 2020-11-19  314  
> cd1a677cad9940 Ilya Dryomov 2020-11-19  315   
> con->v2.conn_bufs[con->v2.conn_buf_cnt++] = buf;
> cd1a677cad9940 Ilya Dryomov 2020-11-19  316   return buf;
> cd1a677cad9940 Ilya Dryomov 2020-11-19  317  }
> cd1a677cad9940 Ilya Dryomov 2020-11-19  318  
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: net/mctp/test/utils.c:15 mctp_test_dev_tx() error: use kfree_skb() here instead of kfree(skb)

2021-11-28 Thread Dan Carpenter
On Mon, Nov 29, 2021 at 10:24:15AM +0800, Jeremy Kerr wrote:
> Hi Dan,
> 
> > smatch warnings:
> > net/mctp/test/utils.c:15 mctp_test_dev_tx() error: use kfree_skb() here 
> > instead of kfree(skb)
> 
> Thanks for the report! I've sent a fix, you're CCed.
> 
> However, I can 't seem to recreate the smatch warning; could you include
> the build command you're using for these? I've tried with
> 
> make [...] C=1 CHECK=/path/to/smatch

The CHECK= string needs a -p=kernel added to it or it won't do kernel
specific checking.

make [...] C=1 CHECK="/path/to/smatch -p=kernel"

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH] vdpa: Consider device id larger than 31

2021-11-28 Thread Dan Carpenter
On Sun, Nov 28, 2021 at 09:14:35AM +0200, Eli Cohen wrote:
> On Fri, Nov 26, 2021 at 10:48:12AM +0800, Jason Wang wrote:
> > On Fri, Nov 26, 2021 at 2:09 AM Parav Pandit  wrote:
> > >
> > > virtio device id value can be more than 31. Hence, use BIT_ULL in
> > > assignment.
> > >
> > > Fixes: 33b347503f01 ("vdpa: Define vdpa mgmt device, ops and a netlink 
> > > interface")
> > > Reported-by: kernel test robot 
> > > Reported-by: Dan Carpenter 
> > > Signed-off-by: Parav Pandit 
> > 
> > Acked-by: Jason Wang 
> > 
> > > ---
> > >  drivers/vdpa/vdpa.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> > > index 7332a74a4b00..e91c71aeeddf 100644
> > > --- a/drivers/vdpa/vdpa.c
> > > +++ b/drivers/vdpa/vdpa.c
> > > @@ -404,7 +404,7 @@ static int vdpa_mgmtdev_fill(const struct 
> > > vdpa_mgmt_dev *mdev, struct sk_buff *m
> > > goto msg_err;
> > >
> > > while (mdev->id_table[i].device) {
> > > -   supported_classes |= BIT(mdev->id_table[i].device);
> > > +   supported_classes |= BIT_ULL(mdev->id_table[i].device);
> > > i++;
> > > }
> > >
> 
> type of mdev->id_table[i].device is __u32 so in theory you're limited
> to device ID's up to 63.

A u32 can fit numbers up to 4 million?  These .device numbers are
normally hardcoded defines listed in usr/include/linux/virtio_ids.h

But sometimes they're not like in vp_modern_probe() which does:

mdev->id.device = pci_dev->device - 0x1040;

I don't know if an assert is really worth it, considering how almost all
of them are hardcoded.  Also if we do want an assert maybe there is a
better place to put it?

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/net/dsa/qca8k.c:944 qca8k_parse_port_config() error: testing array offset 'cpu_port_index' after use.

2021-11-16 Thread Dan Carpenter
On Tue, Nov 16, 2021 at 02:30:59PM +0100, Ansuel Smith wrote:
> > On Mon, Nov 15, 2021 at 07:08:30PM +0100, Ansuel Smith wrote:
> > > > tree:   
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git   
> > > > master
> > > > head:   debe436e77c72fcee804fb867f275e6d31aa999c
> > > > commit: 5654ec78dd7e64b1e04777b24007344329e6a63b net: dsa: qca8k: 
> > > > rework rgmii delay logic and scan for cpu port 6
> > > > config: i386-randconfig-m021-20211025 (attached as .config)
> > > > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > > >
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kernel test robot 
> > > > Reported-by: Dan Carpenter 
> > > >
> > >
> > > This should already be fixed by 06dd34a628ae5b6a839b757e746de165d6789ca8
> > > Can you confirm this?
> > >
> >
> > No, it doesn't fix the problem.  The check is either useless and should
> > be removed or there is an out of bounds bug.  Checking for an out of
> > bounds *after* you've already written to the memory is *never* useful.
> >
> > regards,
> > dan carpenter
> >
> 
> Again sorry if I insist and I'm 99% missing something.
> There was an out of bounds bug.
> It was fixed by 06dd34a628ae5b6a839b757e746de165d6789ca8 by
> starting the counter to -1.
> The extra check is useless, yes.

Then just delete it.  We don't want code which is illogical even if it
has no effect on run time.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/net/dsa/qca8k.c:944 qca8k_parse_port_config() error: testing array offset 'cpu_port_index' after use.

2021-11-15 Thread Dan Carpenter
On Mon, Nov 15, 2021 at 07:08:30PM +0100, Ansuel Smith wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  
> > master
> > head:   debe436e77c72fcee804fb867f275e6d31aa999c
> > commit: 5654ec78dd7e64b1e04777b24007344329e6a63b net: dsa: qca8k: rework 
> > rgmii delay logic and scan for cpu port 6
> > config: i386-randconfig-m021-20211025 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> >
> 
> This should already be fixed by 06dd34a628ae5b6a839b757e746de165d6789ca8
> Can you confirm this?
> 

No, it doesn't fix the problem.  The check is either useless and should
be removed or there is an out of bounds bug.  Checking for an out of
bounds *after* you've already written to the memory is *never* useful.

regards,
dan carpenter

> > smatch warnings:
> > drivers/net/dsa/qca8k.c:944 qca8k_parse_port_config() error: testing array 
> > offset 'cpu_port_index' after use.
> >
> > vim +/cpu_port_index +944 drivers/net/dsa/qca8k.c
> >
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   934  static int
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   935  
> > qca8k_parse_port_config(struct qca8k_priv *priv)
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   936  {
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   937int port, cpu_port_index = 
> > 0, ret;
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   938struct device_node *port_dn;
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   939phy_interface_t mode;
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   940struct dsa_port *dp;
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   941u32 delay;
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   942
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   943/* We have 2 CPU port. 
> > Check them */
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14  @944for (port = 0; port < 
> > QCA8K_NUM_PORTS && cpu_port_index < QCA8K_NUM_CPU_PORTS; port++) {
> > 
> >  ^
> > Assume cpu_port_index = QCA8K_NUM_CPU_PORTS - 1;
> >
> >
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   945/* Skip every other 
> > port */
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   946if (port != 0 && 
> > port != 6)
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   947continue;
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   948
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   949dp = 
> > dsa_to_port(priv->ds, port);
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   950port_dn = dp->dn;
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   951cpu_port_index++;
> > ^
> > cpu_port_index is now out of bounds.
> >
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   952
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   953if 
> > (!of_device_is_available(port_dn))
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   954continue;
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   955
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   956ret = 
> > of_get_phy_mode(port_dn, );
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   957if (ret)
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   958continue;
> > 6c43809bf1bee7 Ansuel Smith 2021-10-14   959
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   960switch (mode) {
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   961case 
> > PHY_INTERFACE_MODE_RGMII:
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   962case 
> > PHY_INTERFACE_MODE_RGMII_ID:
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   963case 
> > PHY_INTERFACE_MODE_RGMII_TXID:
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   964case 
> > PHY_INTERFACE_MODE_RGMII_RXID:
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   965delay = 0;
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   966
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   967if 
> > (!of_property_read_u32(port_dn, "tx-internal-delay-ps", ))
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   968/* 
> > Switch regs accept value in ns, convert ps to ns */
> > 5654ec78dd7e64 Ansuel Smith 2021-10-14   969
> > delay = delay / 1000;
> > 5654ec7

[kbuild] Re: [PATCH v0.7 3/5] sched/umcg: implement UMCG syscalls

2021-10-14 Thread Dan Carpenter
On Thu, Oct 14, 2021 at 02:56:43AM +0800, kernel test robot wrote:
> 
> url:
> https://github.com/0day-ci/linux/commits/Peter-Oskolkov/sched-mm-x86-uaccess-implement-User-Managed-Concurrency-Groups/20211013-072710

How do I do a git fetch of this again?

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [linux-next:master 2736/10638] drivers/net/can/usb/peak_usb/pcan_usb.c:523 pcan_usb_decode_error() error: we previously assumed 'cf' could be null (see line 503)

2021-08-27 Thread Dan Carpenter
Yeah...

Thanks for looking at this.  I should have caught it myself, because I
should have wondered why I hadn't sent a warning for this earlier from
my own test system.

The kbuild-bot doesn't do cross function analysis.  (It adds
hours and hours to the build).  When I build this on my system with
the cross function DB then Smatch parses it correctly.

On Fri, Aug 27, 2021 at 11:20:40AM +0200, Marc Kleine-Budde wrote:
> > 1c0ee046957648 Marc Kleine-Budde 2015-07-11  524netif_rx(skb);
> > 46be265d338833 Stephane Grosjean 2012-03-02  525  
> > 46be265d338833 Stephane Grosjean 2012-03-02  526return 0;
> > 46be265d338833 Stephane Grosjean 2012-03-02  527  }
> 
> This pattern exists in probably more than one driver.
> 
> Should we extend the NULL pointer check to "cf", to make smatch happy?

My philosophy is always that we shouldn't add code just to make the
checker happy.

This is a complicated one because it requires cross function analysis.
When you built the smatch cross function DB, it parses every file and
outputs SQL to describe what the function does.  Then you pipe the SQL
to sqlite3 which takes a few hours just because the DB is so huge (20GB).

Smatch also parses some functions inline in an in-memory database but
that can't work here because alloc_can_err_skb() is in a different .c
file.

I imagine that in a couple years, the first step of a Smatch run will be
to slurp every function into a database raw so that they can be parsed
inline.  That would be a lot faster.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [cxl-cxl:pending 39/40] drivers/cxl/core/bus.c:501 devm_cxl_add_decoder() warn: variable dereferenced before check 'cxld' (see line 497)

2021-08-26 Thread Dan Carpenter
On Wed, Aug 25, 2021 at 10:12:32AM +0300, Dan Carpenter wrote:
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  494  int 
> devm_cxl_add_decoder(struct device *host, struct cxl_decoder *cxld,
> 574d46ed53b527 drivers/cxl/core/bus.c Dan Williams 2021-08-24  495
>  int *target_map)
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  496  {
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24 @497struct 
> cxl_port *port = to_cxl_port(cxld->dev.parent);
>   
>   
> Dereference
> 
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  498struct 
> device *dev;
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  499int rc 
> = 0, i;
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  500  
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24 @501if 
> (!cxld)
> 
> ^
> Checked too late.
> 
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  502
> return -EINVAL;
> 574d46ed53b527 drivers/cxl/core/bus.c Dan Williams 2021-08-24  503  
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  504if 
> (IS_ERR(cxld))
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  505
> return PTR_ERR(cxld);
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  506  
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  507if 
> (cxld->interleave_ways < 1) {
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  508
> rc = -EINVAL;
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  509
> goto err;
> 
> "dev" not initialized at this point.
> 
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  510}
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  511  
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  512
> device_lock(>dev);
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  513if 
> (list_empty(>dports))
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  514
> rc = -EINVAL;
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  515  
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  516for (i 
> = 0; rc == 0 && target_map && i < cxld->nr_targets; i++) {
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  517
> struct cxl_dport *dport = find_dport(port, target_map[i]);
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  518  
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  519
> if (!dport) {
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  520
> rc = -ENXIO;
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  521
> break;
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  522
> }
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  523
> dev_dbg(host, "%s: target: %d\n", dev_name(dport->dport), i);
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  524
> cxld->target[i] = dport;
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  525}
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  526
> device_unlock(>dev);
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  527if (rc)
> b7ca54b6255144 drivers/cxl/core/bus.c Dan Williams 2021-08-24  528
> goto err;
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  529  
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  530dev = 
> >dev;
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  531rc = 
> dev_set_name(dev, "decoder%d.%d", port->id, cxld->id);
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  532if (rc)
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  533
> goto err;
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  534  
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  535rc = 
> device_add(dev);
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  536if (rc)
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  537
> goto err;
> 40ba17afdfabb0 drivers/cxl/core.c Dan Williams 2021-06-09  538  
> b7ca54b6255144 drivers/cx

[kbuild] Re: drivers/pinctrl/pinctrl-k210.c:970 k210_fpioa_probe() warn: 'pdata->clk' not released on lines: 962,968.

2021-08-02 Thread Dan Carpenter
On Sun, Aug 01, 2021 at 10:50:51PM +, Damien Le Moal wrote:
> 
> I can add the clk_unprepare_disable() call to avoid the warning, but that is
> rather pointless as the system will not boot at all if there is an error here.
> Thoughts ?

These static checker warnings just a one time email service.  If you
don't want to free resources then that's fine.  If people run Smatch
manually then they'll still see the warnings but the kbuild bot won't
email about it again.


regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [linux-next:master 1517/2389] sound/pci/als4000.c:930 snd_card_als4000_probe() warn: 'pci' not released on lines: 852,872.

2021-07-26 Thread Dan Carpenter
On Thu, Jul 22, 2021 at 06:19:19PM +0200, Takashi Iwai wrote:
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  827  
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  828  /* enable PCI device */
> > 0e175f665960c7 Takashi Iwai2021-07-15  829  err = 
> > pcim_enable_device(pci);
> > 61ea06e8a88163 Takashi Iwai2021-06-08  830  if (err < 0)
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  831  return err;
> > 61ea06e8a88163 Takashi Iwai2021-06-08  832  
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  833  /* check, if we can 
> > restrict PCI DMA transfers to 24 bits */
> > 669f65eaeb969e Takashi Iwai2021-01-14  834  if 
> > (dma_set_mask_and_coherent(>dev, DMA_BIT_MASK(24))) {
> > d85d878efb3047 Takashi Iwai2014-02-25  835  
> > dev_err(>dev, "architecture does not support 24bit PCI busmaster 
> > DMA\n");
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  836  return -ENXIO;
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  837  }
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  838  
> > 61ea06e8a88163 Takashi Iwai2021-06-08  839  err = 
> > pci_request_regions(pci, "ALS4000");
> > 
> > ^
> > 0e175f665960c7 Takashi Iwai2021-07-15  840  if (err < 0)
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  841  return err;
> > c0874449849175 Andreas Mohr2008-08-20  842  iobase = 
> > pci_resource_start(pci, 0);
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  843  
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  844  
> > pci_read_config_word(pci, PCI_COMMAND, );
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  845  
> > pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO);
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  846  pci_set_master(pci);
> > ^1da177e4c3f41 Linus Torvalds  2005-04-16  847  
> > 0e175f665960c7 Takashi Iwai2021-07-15  848  err = 
> > snd_devm_card_new(>dev, index[dev], id[dev], THIS_MODULE,
> > e58de7baf7de11 Takashi Iwai2008-12-28  849  
> > sizeof(*acard) /* private_data: acard */,
> > e58de7baf7de11 Takashi Iwai2008-12-28  850  
> > );
> > 0e175f665960c7 Takashi Iwai2021-07-15  851  if (err < 0)
> > e58de7baf7de11 Takashi Iwai2008-12-28  852  return err;
> > ^^
> > Smatch complains because there is no error handling.  Maybe the other
> > error paths use devm_ magic?  Or more likely Smatch just isn't smart
> > enough...
> 
> I believe those are false-positive.
> 
> When the PCI device is already managed via pcim_enable_device(), all
> resources (even the ones without pcim_ or devm_) are freed
> automagically.

Thanks!  I've marked everything after pcim_enable_device or
pci_enable_device() as managed (will push later).

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/remoteproc/mtk_scp.c:570 scp_probe() warn: missing error code 'ret'

2021-07-10 Thread Dan Carpenter
On Sat, Jul 10, 2021 at 02:17:54AM +0800, kernel test robot wrote:
> CC: kbuild-...@lists.01.org
> CC: linux-ker...@vger.kernel.org
> TO: Alexandre Courbot 
> CC: Mauro Carvalho Chehab 
> CC: linux-me...@vger.kernel.org
> 
> Hi Alexandre,
> 
> First bad commit (maybe != root cause):
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   f55966571d5eb2876a11e48e798b4592fa1ffbb7
> commit: cbd2dca74926c0e4610c40923cc786b732c9e8ef remoteproc: scp: add 
> COMPILE_TEST dependency
> date:   10 months ago
> :: branch date: 23 hours ago
> :: commit date: 10 months ago
> config: openrisc-randconfig-m031-20210709 (attached as .config)

Smatch seesm to completely fall apart on some of these arches.  I don't
know why...  :/  I think it's because Smatch thinks the pointers are
signed or something and that messes up parsing of PTR_ERR()?

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH v3 3/5] staging: vchiq: Move vchiq char driver to its own file

2021-07-05 Thread Dan Carpenter
On Mon, Jul 05, 2021 at 04:28:04PM +0530, Ojaswin Mujoo wrote:
> Hello Dan,
> 
> On Mon, Jul 05, 2021 at 12:56:09PM +0300, Dan Carpenter wrote:
> > Hi Ojaswin,
> > 
> > url:
> > https://github.com/0day-ci/linux/commits/Ojaswin-Mujoo/vchiq-Patch-to-separate-platform-and-cdev-code/20210705-000124
> >  
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git  
> > 77ad1f0e99bd00af024e650b862cfda3137af660
> > config: i386-randconfig-m021-20210705 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> > 
> > smatch warnings:
> > drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:1235 
> > vchiq_release() warn: argument 3 to %lx specifier is cast from pointer
> > 
> > vim +1235 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
> > 
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1227  static int 
> > vchiq_release(struct inode *inode, struct file *file)
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1228  {
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1229   struct vchiq_instance 
> > *instance = file->private_data;
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1230   struct vchiq_state 
> > *state = vchiq_get_state();
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1231   struct vchiq_service 
> > *service;
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1232   int ret = 0;
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1233   int i;
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1234  
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04 @1235   
> > vchiq_log_info(vchiq_arm_log_level, "%s: instance=%lx", __func__,
> > 62b5eb4fdf3f5f Ojaswin Mujoo 2021-07-04  1236  
> > (unsigned long)instance);
> > 
> > This should eventually be converted to %p so it doesn't defeat KASLR.
> > (Not that we really care on raspberry pi, I think?)
> Yes, that does seem right, however, this patchset only moves the code from
> vchiq_arm.c to vchiq_dev.c and I've not really touched any of the
> existing code itself (Except moving it to a new file which is why it shows up
> in the patch). 
> 
> Hence, I'm not sure if this fix is in scope of this patchset. (I also
> have a similar warning by kernel test robot here [1] which and I'm not
> sure if I need to act upon). Maybe we can look at this in a separate
> patch?

Yes.  Correct.  Don't mix this into the patch, do it "eventually".  Or
you don't have to do it at all since it wasn't something you introduced.
Someone will check the driver for Smatch warnings before it can be moved
out of staging.

(I just forwarded the kbuild bot messages for informational purposes
only).

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [Intel-gfx] [drm-intel:drm-intel-gt-next 8/14] drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized symbol 'rq'.

2021-07-02 Thread Dan Carpenter
On Fri, Jul 02, 2021 at 12:34:33PM +0100, Matthew Auld wrote:
> > > > cf586021642d80 Chris Wilson 2021-06-17   85 err = 
> > > > fn(migrate, , src, dst, );
> > > > cf586021642d80 Chris Wilson 2021-06-17   86 if (!err)
> > > > cf586021642d80 Chris Wilson 2021-06-17   87 
> > > > continue;
> > > >
> > > > Does fn() initialize "rq" on the success path?  Anyway Smatch would
> > > > complain anyway because it thinks the list could be empty or that we
> > > > might hit and early continue for everything.
> > >
> > > The fn() will always first initialize the rq to NULL. If it returns
> > > success then rq will always be a valid rq. If it returns an err then
> > > the rq might be NULL, or a valid rq depending on how far the copy/fn
> > > got.
> > >
> > > And for_i915_gem_ww() will always run at least once, since ww->loop =
> > > true, so this looks like a false positive?
> >
> > You don't think i915_gem_object_lock(), i915_gem_object_pin_map() or
> > i915_gem_object_pin_map() can fail?
> 
> Yeah, they can totally fail but then we mostly likely just hit the
> err_out. The for_i915_gem_ww() is a little strange since it's not
> really looping over anything, it's just about retrying the block if we
> see -EDEADLK(which involves dropping some locks), if we see any other
> error then the loop is terminated with ww->loop = false, which then
> hits the goto err_out.
> 

Ah, yeah, you're right.  False positive.

I hadn't looked at this code in context (I only had reviewed the email).
Now that I've pulled the tree and looked at the code, then I'm sort of
surprised that Smatch generates a warning...  I will investigate some
more.  Thanks!

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [Intel-gfx] [drm-intel:drm-intel-gt-next 8/14] drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized symbol 'rq'.

2021-07-02 Thread Dan Carpenter
On Fri, Jul 02, 2021 at 02:07:27PM +0300, Dan Carpenter wrote:
> On Fri, Jul 02, 2021 at 11:32:45AM +0100, Matthew Auld wrote:
> > On Fri, 2 Jul 2021 at 09:45, Dan Carpenter  wrote:
> > > cf586021642d80 Chris Wilson 2021-06-17   84
> > > cf586021642d80 Chris Wilson 2021-06-17   85 err = fn(migrate, 
> > > , src, dst, );
> > > cf586021642d80 Chris Wilson 2021-06-17   86 if (!err)
> > > cf586021642d80 Chris Wilson 2021-06-17   87 continue;
> > >
> > > Does fn() initialize "rq" on the success path?  Anyway Smatch would
> > > complain anyway because it thinks the list could be empty or that we
> > > might hit and early continue for everything.
> > 
> > The fn() will always first initialize the rq to NULL. If it returns
> > success then rq will always be a valid rq. If it returns an err then
> > the rq might be NULL, or a valid rq depending on how far the copy/fn
> > got.
> > 
> > And for_i915_gem_ww() will always run at least once, since ww->loop =
> > true, so this looks like a false positive?
> 
> You don't think i915_gem_object_lock(), i915_gem_object_pin_map() or
> i915_gem_object_pin_map() can fail?

Btw, I sincerely hope that we will re-enable GCC's uninitialized
variable checks.  Will GCC be able to verify that this is initialized?

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [Intel-gfx] [drm-intel:drm-intel-gt-next 8/14] drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized symbol 'rq'.

2021-07-02 Thread Dan Carpenter
On Fri, Jul 02, 2021 at 11:32:45AM +0100, Matthew Auld wrote:
> On Fri, 2 Jul 2021 at 09:45, Dan Carpenter  wrote:
> >
> > tree:   git://anongit.freedesktop.org/drm-intel drm-intel-gt-next
> > head:   5cd57f676bb946a00275408f0dd0d75dbc466d25
> > commit: cf586021642d8017cde111b7dd1ba86224e9da51 [8/14] drm/i915/gt: 
> > Pipelined page migration
> > config: x86_64-randconfig-m001-20210630 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> >
> > New smatch warnings:
> > drivers/gpu/drm/i915/gt/selftest_migrate.c:102 copy() error: uninitialized 
> > symbol 'rq'.
> > drivers/gpu/drm/i915/gt/selftest_migrate.c:113 copy() error: uninitialized 
> > symbol 'vaddr'.
> >
> > Old smatch warnings:
> > drivers/gpu/drm/i915/gem/i915_gem_object.h:182 __i915_gem_object_lock() 
> > error: we previously assumed 'ww' could be null (see line 171)
> >
> > vim +/rq +102 drivers/gpu/drm/i915/gt/selftest_migrate.c
> >
> > cf586021642d80 Chris Wilson 2021-06-17   32  static int copy(struct 
> > intel_migrate *migrate,
> > cf586021642d80 Chris Wilson 2021-06-17   33 int (*fn)(struct 
> > intel_migrate *migrate,
> > cf586021642d80 Chris Wilson 2021-06-17   34   struct 
> > i915_gem_ww_ctx *ww,
> > cf586021642d80 Chris Wilson 2021-06-17   35   struct 
> > drm_i915_gem_object *src,
> > cf586021642d80 Chris Wilson 2021-06-17   36   struct 
> > drm_i915_gem_object *dst,
> > cf586021642d80 Chris Wilson 2021-06-17   37   struct 
> > i915_request **out),
> > cf586021642d80 Chris Wilson 2021-06-17   38 u32 sz, struct 
> > rnd_state *prng)
> > cf586021642d80 Chris Wilson 2021-06-17   39  {
> > cf586021642d80 Chris Wilson 2021-06-17   40 struct drm_i915_private 
> > *i915 = migrate->context->engine->i915;
> > cf586021642d80 Chris Wilson 2021-06-17   41 struct drm_i915_gem_object 
> > *src, *dst;
> > cf586021642d80 Chris Wilson 2021-06-17   42 struct i915_request *rq;
> > cf586021642d80 Chris Wilson 2021-06-17   43 struct i915_gem_ww_ctx ww;
> > cf586021642d80 Chris Wilson 2021-06-17   44 u32 *vaddr;
> > cf586021642d80 Chris Wilson 2021-06-17   45 int err = 0;
> >
> > One way to silence these warnings would be to initialize err = -EINVAL.
> > Then Smatch would know that we goto err_out for an empty list.
> >
> > cf586021642d80 Chris Wilson 2021-06-17   46 int i;
> > cf586021642d80 Chris Wilson 2021-06-17   47
> > cf586021642d80 Chris Wilson 2021-06-17   48 src = 
> > create_lmem_or_internal(i915, sz);
> > cf586021642d80 Chris Wilson 2021-06-17   49 if (IS_ERR(src))
> > cf586021642d80 Chris Wilson 2021-06-17   50 return 0;
> > cf586021642d80 Chris Wilson 2021-06-17   51
> > cf586021642d80 Chris Wilson 2021-06-17   52 dst = 
> > i915_gem_object_create_internal(i915, sz);
> > cf586021642d80 Chris Wilson 2021-06-17   53 if (IS_ERR(dst))
> > cf586021642d80 Chris Wilson 2021-06-17   54 goto err_free_src;
> > cf586021642d80 Chris Wilson 2021-06-17   55
> > cf586021642d80 Chris Wilson 2021-06-17   56 for_i915_gem_ww(, err, 
> > true) {
> > cf586021642d80 Chris Wilson 2021-06-17   57 err = 
> > i915_gem_object_lock(src, );
> > cf586021642d80 Chris Wilson 2021-06-17   58 if (err)
> > cf586021642d80 Chris Wilson 2021-06-17   59 continue;
> > cf586021642d80 Chris Wilson 2021-06-17   60
> > cf586021642d80 Chris Wilson 2021-06-17   61 err = 
> > i915_gem_object_lock(dst, );
> > cf586021642d80 Chris Wilson 2021-06-17   62 if (err)
> > cf586021642d80 Chris Wilson 2021-06-17   63 continue;
> > cf586021642d80 Chris Wilson 2021-06-17   64
> > cf586021642d80 Chris Wilson 2021-06-17   65 vaddr = 
> > i915_gem_object_pin_map(src, I915_MAP_WC);
> > cf586021642d80 Chris Wilson 2021-06-17   66 if (IS_ERR(vaddr)) {
> > cf586021642d80 Chris Wilson 2021-06-17   67 err = 
> > PTR_ERR(vaddr);
> > cf586021642d80 Chris Wilson 2021-06-17   68 continue;
> > cf586021642d80 Chris Wilson 2021-06-17   69 }
> > cf586021642d80 Chris Wilson 2021-06-17   70
> > cf586021642d80 Chris Wilson 2021-06-17   71 for (i = 0; i < sz 
> > / sizeof(u32); i++)
> > cf586021642d8

[kbuild] Re: [PATCH v3 07/15] fsnotify: pass arguments of fsnotify() in struct fsnotify_event_info

2021-06-30 Thread Dan Carpenter
I think my bug report was not clear...  :/  The code looks like this:

sb = inode->i_sb;

if (inode) ...

The NULL check cannot be false because if "inode" is NULL we would have
already crashed when we dereference it on the line before.

In this case, based on last years discussion, the "inode" pointer can't
be NULL.  The debate is only whether the unnecessary NULL checks help
readability or hurt readability.

> Why does it presume that event_info->dir is non-NULL?

That was my commentary, just from reading the code.  Smatch says that
"event->dir" is unknown.

> Did smach check all the callers to fsnotify() or something?

The kbuild-bot doesn't build the cross function database but if you did
use the cross function database then, yes, it does track all the
callers.  There are two pointers that we care about, the "inode" and
the parent inode (dir).  Smatch can figure out when "inode" is NULL vs
non-NULL but where it gets stuck is on the some of the parent inodes
like this call from fsnotify_dirent():

fsnotify_name(dir, mask, d_inode(dentry), >d_name, 0);
 ^^^

Smatch doesn't know that d_inode() is always non-NULL at this point.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH v3 07/15] fsnotify: pass arguments of fsnotify() in struct fsnotify_event_info

2021-06-30 Thread Dan Carpenter
On Wed, Jun 30, 2021 at 11:35:32AM +0300, Amir Goldstein wrote:
> 
> Do you have feeling of dejavu? ;-)
> https://lore.kernel.org/linux-fsdevel/20200730192537.gb13...@quack2.suse.cz/ 

That was a year ago.  I have trouble remembering emails I sent
yesterday.

> 
> We've been through this.
> Maybe you silenced the smach warning on fsnotify() and the rename to
> __fsnotifty()
> caused this warning to refloat?

Yes.  Renaming the function will make it show up as a new warning.  Also
this is an email from the kbuild-bot and last years email was from me,
so it's a different tool and a different record of sent messages.

(IMO, you should really just remove the bogus NULL checks because
everyone looking at the warning will think the code is buggy).

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH/rfc] NFS: introduce NFS namespaces.

2021-06-28 Thread Dan Carpenter
On Mon, Jun 28, 2021 at 10:14:13AM +1000, NeilBrown wrote:
> On Fri, 25 Jun 2021, Dan Carpenter wrote:
> > Hi NeilBrown,
> > 
> > url:
> > https://github.com/0day-ci/linux/commits/NeilBrown/NFS-introduce-NFS-namespaces/20210625-093359
> >  
> > base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
> > config: x86_64-randconfig-m001-20210622 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> 
> I assume this only applies if I fix the issue with a separate patch?

That's stuff the kbuild-bot adds.  I just review the bug report and hit
forward.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: net/sunrpc/xprtrdma/frwr_ops.c:647 frwr_unmap_async() error: potentially dereferencing uninitialized 'last'.

2021-06-23 Thread Dan Carpenter
On Wed, Jun 23, 2021 at 03:20:10PM +0300, Chuck Lever III wrote:
> Howdy Dan!
> 
> > On Jun 23, 2021, at 6:07 AM, Dan Carpenter  wrote:
> > 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> > master
> > head:   0c18f29aae7ce3dadd26d8ee3505d07cc982df75
> > commit: e10fa96d347488d1fd278e84f52ba7b25067cc71 xprtrdma: Move cqe to 
> > struct rpcrdma_mr
> > config: x86_64-randconfig-m001-20210622 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> > 
> > New smatch warnings:
> > net/sunrpc/xprtrdma/frwr_ops.c:647 frwr_unmap_async() error: potentially 
> > dereferencing uninitialized 'last'.
> > 
> > Old smatch warnings:
> > net/sunrpc/xprtrdma/frwr_ops.c:546 frwr_unmap_sync() error: potentially 
> > dereferencing uninitialized 'last'.
> > 
> > vim +/last +647 net/sunrpc/xprtrdma/frwr_ops.c
> > 
> > d8099feda4833b Chuck Lever 2019-06-19  608  void frwr_unmap_async(struct 
> > rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
> > d8099feda4833b Chuck Lever 2019-06-19  609  {
> > d8099feda4833b Chuck Lever 2019-06-19  610  struct ib_send_wr 
> > *first, *last, **prev;
> > 5ecef9c8436695 Chuck Lever 2020-11-09  611  struct rpcrdma_ep *ep = 
> > r_xprt->rx_ep;
> > d8099feda4833b Chuck Lever 2019-06-19  612  struct rpcrdma_frwr 
> > *frwr;
> > d8099feda4833b Chuck Lever 2019-06-19  613  struct rpcrdma_mr *mr;
> > d8099feda4833b Chuck Lever 2019-06-19  614  int rc;
> > d8099feda4833b Chuck Lever 2019-06-19  615  
> > d8099feda4833b Chuck Lever 2019-06-19  616  /* Chain the LOCAL_INV 
> > Work Requests and post them with
> > d8099feda4833b Chuck Lever 2019-06-19  617   * a single 
> > ib_post_send() call.
> > d8099feda4833b Chuck Lever 2019-06-19  618   */
> > d8099feda4833b Chuck Lever 2019-06-19  619  frwr = NULL;
> > d8099feda4833b Chuck Lever 2019-06-19  620  prev = 
> > 265a38d4611360 Chuck Lever 2019-08-19  621  while ((mr = 
> > rpcrdma_mr_pop(>rl_registered))) {
> > 
> > Is it possible for the ->rl_registered list to be empty?
> 
> The one and only call site for frwr_unmap_async() in in 
> rpcrdma_reply_handler():
> 
> 1483 if (!list_empty(>rl_registered))
> 1484 frwr_unmap_async(r_xprt, req);
> 1485 /* LocalInv completion will complete the RPC */
> 1486 else
> 1487 kref_put(>rl_kref, rpcrdma_reply_done);
> 
> 
> > If not, then just ignore this email.
> 
> I seem to recall smatch catching this problem before. Is there a way
> to annotate frwr_unmap_async() to calm smatch's nerves?

In theory, if you have the cross function DB built then it's not
supposed to print this warning.  But in reality it does.  The data is
stored correctly in DB, but it's not used correctly.  Huh...  I will
investigate.

I don't think the kbuild bot uses the cross function DB, but it only
sends the warning once so who cares.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [input:next 2732/2735] drivers/input/touchscreen/resistive-adc-touch.c:84 grts_cb() error: uninitialized symbol 'z2'.

2021-05-27 Thread Dan Carpenter
On Thu, May 27, 2021 at 12:19:51PM +0200, Oleksij Rempel wrote:
> Hi,
> 
> On Thu, May 27, 2021 at 12:30:00PM +0300, Dan Carpenter wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git  next
> > head:   6cf3b3abbf0b3b778138c0f8936aa7820af62cfc
> > commit: fb082cd59afa7fbd3a610e9835050675040b1b99 [2732/2735] Input: 
> > resistive-adc-touch - add support for z1 and z2 channels
> > config: x86_64-randconfig-m001-20210526 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> > 
> > New smatch warnings:
> > drivers/input/touchscreen/resistive-adc-touch.c:84 grts_cb() error: 
> > uninitialized symbol 'z2'.
> > drivers/input/touchscreen/resistive-adc-touch.c:88 grts_cb() error: 
> > uninitialized symbol 'x'.
> > drivers/input/touchscreen/resistive-adc-touch.c:101 grts_cb() error: 
> > uninitialized symbol 'y'.
> > 
> > Old smatch warnings:
> > drivers/input/touchscreen/resistive-adc-touch.c:101 grts_cb() error: 
> > uninitialized symbol 'x'.
> > drivers/input/touchscreen/resistive-adc-touch.c:109 grts_cb() error: 
> > uninitialized symbol 'y'.
> > 
> > vim +/z2 +84 drivers/input/touchscreen/resistive-adc-touch.c
> > 
> > aa132ffb6b0a18 Eugen Hristev  2018-05-22   56  static int grts_cb(const 
> > void *data, void *private)
> > aa132ffb6b0a18 Eugen Hristev  2018-05-22   57  {
> > aa132ffb6b0a18 Eugen Hristev  2018-05-22   58   const u16 *touch_info = 
> > data;
> > aa132ffb6b0a18 Eugen Hristev  2018-05-22   59   struct grts_state *st = 
> > private;
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   60   unsigned int x, y, 
> > press = 0, z1 = 0, z2;
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   61   unsigned int Rt, i;
> > aa132ffb6b0a18 Eugen Hristev  2018-05-22   62  
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   63   for (i = 0; i < 
> > ARRAY_SIZE(st->ch) && st->ch[i] != GRTS_CH_NONE; i++) {
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   64   switch 
> > (st->ch[i]) {
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   65   case GRTS_CH_X:
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   66   x = 
> > touch_info[i];
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   67   break;
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   68   case GRTS_CH_Y:
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   69   y = 
> > touch_info[i];
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   70   break;
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   71   case 
> > GRTS_CH_PRESSURE:
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   72   press = 
> > touch_info[i];
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   73   break;
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   74   case GRTS_CH_Z1:
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   75   z1 = 
> > touch_info[i];
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   76   break;
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   77   case GRTS_CH_Z2:
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   78   z2 = 
> > touch_info[i];
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   79   break;
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   80   }
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   81   }
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   82  
> > fb082cd59afa7f Oleksij Rempel 2021-05-25   83   if (z1) {
> > fb082cd59afa7f Oleksij Rempel 2021-05-25  @84   Rt = z2;
> > 
> > It's likely this is a false positive, but we can see why the static
> > checker would complain.
> 
> The presence of this values was validated on probe. Do we really need
> extra set them to 0?

You don't need to do anything.  ;)  These are a one time email.  I just
look it over and hit forward.

Currently GCC's uninitialized variable checking is disabled in the
kernel otherwise there would be more presure to silence the checker
warning.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3598 mlxsw_sp_nexthop_group_refresh() warn: missing error code 'err'

2021-05-15 Thread Dan Carpenter
On Sat, May 15, 2021 at 07:53:43PM +0300, Dan Carpenter wrote:
> On Sat, May 15, 2021 at 06:48:40PM +0300, Ido Schimmel wrote:
> > On Fri, May 14, 2021 at 05:35:00PM +0300, Dan Carpenter wrote:
> > > tree:   
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master
> > > head:   315d99318179b9cd5077ccc9f7f26a164c9fa998
> > > commit: e3ddfb45bacdc623eedea7f7bf9e7879257471d6 mlxsw: spectrum_router: 
> > > Allow returning errors from mlxsw_sp_nexthop_group_refresh()
> > > config: x86_64-randconfig-m031-20210514 (attached as .config)
> > > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > > 
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot 
> > > Reported-by: Dan Carpenter 
> > > 
> > > smatch warnings:
> > > drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3598 
> > > mlxsw_sp_nexthop_group_refresh() warn: missing error code 'err'
> > > 
> > > vim +/err +3598 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> > > 
> > > e3ddfb45bacdc6 Ido Schimmel   2020-11-17  3555  static int
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3556  
> > > mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp,
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3557
> > >struct mlxsw_sp_nexthop_group *nh_grp)
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3558  {
> > > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3559struct 
> > > mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi;
> > > eb789980d0aa6c Ido Schimmel   2017-10-22  3560u16 ecmp_size, 
> > > old_ecmp_size;
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3561struct 
> > > mlxsw_sp_nexthop *nh;
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3562bool 
> > > offload_change = false;
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3563u32 adj_index;
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3564bool 
> > > old_adj_index_valid;
> > > e3ddfb45bacdc6 Ido Schimmel   2020-11-17  3565int i, err2, 
> > > err = 0;
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3566u32 
> > > old_adj_index;
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3567  
> > > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3568if 
> > > (!nhgi->gateway) {
> > > b3e8d1ebad2d04 Ido Schimmel   2017-02-08  3569
> > > mlxsw_sp_nexthop_fib_entries_update(mlxsw_sp, nh_grp);
> > > e3ddfb45bacdc6 Ido Schimmel   2020-11-17  3570return 
> > > 0;
> > > b3e8d1ebad2d04 Ido Schimmel   2017-02-08  3571}
> > > b3e8d1ebad2d04 Ido Schimmel   2017-02-08  3572  
> > > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3573for (i = 0; i < 
> > > nhgi->count; i++) {
> > > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3574nh = 
> > > >nexthops[i];
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3575  
> > > 56b8a9ed276bc1 Petr Machata   2017-07-31  3576if 
> > > (nh->should_offload != nh->offloaded) {
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3577
> > > offload_change = true;
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3578
> > > if (nh->should_offload)
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3579
> > > nh->update = 1;
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3580}
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3581}
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3582if 
> > > (!offload_change) {
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3583/* 
> > > Nothing was added or removed, so no need to reallocate. Just
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3584 * 
> > > update MAC on existing adjacency indexes.
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3585 */
> > > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3586err = 
> > > mlxsw_sp_nexthop_group_update(mlxsw_sp, nhgi, false);
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3587if 
> > > (err) {
> > > a7ff87acd995e3 Jiri Pirko 2016-07-05  3588   

[kbuild] Re: drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3598 mlxsw_sp_nexthop_group_refresh() warn: missing error code 'err'

2021-05-15 Thread Dan Carpenter
On Sat, May 15, 2021 at 06:48:40PM +0300, Ido Schimmel wrote:
> On Fri, May 14, 2021 at 05:35:00PM +0300, Dan Carpenter wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  
> > master
> > head:   315d99318179b9cd5077ccc9f7f26a164c9fa998
> > commit: e3ddfb45bacdc623eedea7f7bf9e7879257471d6 mlxsw: spectrum_router: 
> > Allow returning errors from mlxsw_sp_nexthop_group_refresh()
> > config: x86_64-randconfig-m031-20210514 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot 
> > Reported-by: Dan Carpenter 
> > 
> > smatch warnings:
> > drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3598 
> > mlxsw_sp_nexthop_group_refresh() warn: missing error code 'err'
> > 
> > vim +/err +3598 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> > 
> > e3ddfb45bacdc6 Ido Schimmel   2020-11-17  3555  static int
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3556  
> > mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp,
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3557  
> >struct mlxsw_sp_nexthop_group *nh_grp)
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3558  {
> > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3559  struct 
> > mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi;
> > eb789980d0aa6c Ido Schimmel   2017-10-22  3560  u16 ecmp_size, 
> > old_ecmp_size;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3561  struct 
> > mlxsw_sp_nexthop *nh;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3562  bool 
> > offload_change = false;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3563  u32 adj_index;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3564  bool 
> > old_adj_index_valid;
> > e3ddfb45bacdc6 Ido Schimmel   2020-11-17  3565  int i, err2, 
> > err = 0;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3566  u32 
> > old_adj_index;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3567  
> > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3568  if 
> > (!nhgi->gateway) {
> > b3e8d1ebad2d04 Ido Schimmel   2017-02-08  3569  
> > mlxsw_sp_nexthop_fib_entries_update(mlxsw_sp, nh_grp);
> > e3ddfb45bacdc6 Ido Schimmel   2020-11-17  3570  return 
> > 0;
> > b3e8d1ebad2d04 Ido Schimmel   2017-02-08  3571  }
> > b3e8d1ebad2d04 Ido Schimmel   2017-02-08  3572  
> > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3573  for (i = 0; i < 
> > nhgi->count; i++) {
> > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3574  nh = 
> > >nexthops[i];
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3575  
> > 56b8a9ed276bc1 Petr Machata   2017-07-31  3576  if 
> > (nh->should_offload != nh->offloaded) {
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3577  
> > offload_change = true;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3578  
> > if (nh->should_offload)
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3579  
> > nh->update = 1;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3580  }
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3581  }
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3582  if 
> > (!offload_change) {
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3583  /* 
> > Nothing was added or removed, so no need to reallocate. Just
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3584   * 
> > update MAC on existing adjacency indexes.
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3585   */
> > 7f7a417e6a11d7 Ido Schimmel   2020-11-13  3586  err = 
> > mlxsw_sp_nexthop_group_update(mlxsw_sp, nhgi, false);
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3587  if 
> > (err) {
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3588  
> > dev_warn(mlxsw_sp->bus_info->dev, "Failed to update neigh MAC in adjacency 
> > table.\n");
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3589  
> > goto set_trap;
> > a7ff87acd995e3 Jiri Pirko 2016-07-05  3590  }
> > e3ddfb45bacdc6 Ido Schimmel   2020-11-17  3591   

[kbuild] drivers/gpu/drm/exynos/exynos_drm_dma.c:144 exynos_drm_register_dma() error: uninitialized symbol 'mapping'.

2021-05-03 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   9ccce092fc64d19504fa54de4fd659e279cc92e7
commit: b4ceb4a5359ed1c9ba4a20acf3a70d4bbead3248 iommu: Tidy up Kconfig for SoC 
IOMMUs
config: microblaze-randconfig-m031-20210503 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/gpu/drm/exynos/exynos_drm_dma.c:144 exynos_drm_register_dma() error: 
uninitialized symbol 'mapping'.

vim +/mapping +144 drivers/gpu/drm/exynos/exynos_drm_dma.c

07dc3678bacc2a Marek Szyprowski 2020-03-09  121  int 
exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
07dc3678bacc2a Marek Szyprowski 2020-03-09  122 
void **dma_priv)
237556962e5115 Andrzej Hajda2018-10-12  123  {
237556962e5115 Andrzej Hajda2018-10-12  124 struct 
exynos_drm_private *priv = drm->dev_private;
237556962e5115 Andrzej Hajda2018-10-12  125  
237556962e5115 Andrzej Hajda2018-10-12  126 if (!priv->dma_dev) {
237556962e5115 Andrzej Hajda2018-10-12  127 priv->dma_dev = 
dev;
237556962e5115 Andrzej Hajda2018-10-12  128 
DRM_INFO("Exynos DRM: using %s device for DMA mapping operations\n",
237556962e5115 Andrzej Hajda2018-10-12  129  
dev_name(dev));
237556962e5115 Andrzej Hajda2018-10-12  130 }
67fbf3a3ef8443 Andrzej Hajda2018-10-12  131  
67fbf3a3ef8443 Andrzej Hajda2018-10-12  132 if 
(!IS_ENABLED(CONFIG_EXYNOS_IOMMU))
67fbf3a3ef8443 Andrzej Hajda2018-10-12  133 return 0;
67fbf3a3ef8443 Andrzej Hajda2018-10-12  134  
67fbf3a3ef8443 Andrzej Hajda2018-10-12  135 if (!priv->mapping) {
67fbf3a3ef8443 Andrzej Hajda2018-10-12  136 void *mapping;
67fbf3a3ef8443 Andrzej Hajda2018-10-12  137  
67fbf3a3ef8443 Andrzej Hajda2018-10-12  138 if 
(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
67fbf3a3ef8443 Andrzej Hajda2018-10-12  139 mapping 
= arm_iommu_create_mapping(_bus_type,
67fbf3a3ef8443 Andrzej Hajda2018-10-12  140 
EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE);
67fbf3a3ef8443 Andrzej Hajda2018-10-12  141 else if 
(IS_ENABLED(CONFIG_IOMMU_DMA))
67fbf3a3ef8443 Andrzej Hajda2018-10-12  142 mapping 
= iommu_get_domain_for_dev(priv->dma_dev);
67fbf3a3ef8443 Andrzej Hajda2018-10-12  143  

Both CONFIG_ options disabled in the attached .config file.

67fbf3a3ef8443 Andrzej Hajda2018-10-12 @144 if 
(IS_ERR(mapping))
67fbf3a3ef8443 Andrzej Hajda2018-10-12  145 return 
PTR_ERR(mapping);
67fbf3a3ef8443 Andrzej Hajda2018-10-12  146 priv->mapping = 
mapping;
237556962e5115 Andrzej Hajda2018-10-12  147 }
237556962e5115 Andrzej Hajda2018-10-12  148  
07dc3678bacc2a Marek Szyprowski 2020-03-09  149 return 
drm_iommu_attach_device(drm, dev, dma_priv);
237556962e5115 Andrzej Hajda2018-10-12  150  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [Patch v3 6/7] crypto: qce: common: Add support for AEAD algorithms

2021-04-28 Thread Dan Carpenter
Hi Thara,

url:
https://github.com/0day-ci/linux/commits/Thara-Gopinath/Add-support-for-AEAD-algorithms-in-Qualcomm-Crypto-Engine-driver/20210420-113944
 
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git  
master
config: arm-randconfig-m031-20210428 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/crypto/qce/common.c:482 qce_setup_regs_aead() error: uninitialized 
symbol 'auth_ivsize'.

vim +/auth_ivsize +482 drivers/crypto/qce/common.c

b152c1b17bb6ad Thara Gopinath 2021-04-19  419  static int 
qce_setup_regs_aead(struct crypto_async_request *async_req)
b152c1b17bb6ad Thara Gopinath 2021-04-19  420  {
b152c1b17bb6ad Thara Gopinath 2021-04-19  421   struct aead_request *req = 
aead_request_cast(async_req);
b152c1b17bb6ad Thara Gopinath 2021-04-19  422   struct qce_aead_reqctx *rctx = 
aead_request_ctx(req);
b152c1b17bb6ad Thara Gopinath 2021-04-19  423   struct qce_aead_ctx *ctx = 
crypto_tfm_ctx(async_req->tfm);
b152c1b17bb6ad Thara Gopinath 2021-04-19  424   struct qce_alg_template *tmpl = 
to_aead_tmpl(crypto_aead_reqtfm(req));
b152c1b17bb6ad Thara Gopinath 2021-04-19  425   struct qce_device *qce = 
tmpl->qce;
b152c1b17bb6ad Thara Gopinath 2021-04-19  426   u32 
enckey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  427   u32 enciv[QCE_MAX_IV_SIZE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  428   u32 
authkey[QCE_SHA_HMAC_KEY_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  429   u32 authiv[SHA256_DIGEST_SIZE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  430   u32 authnonce[QCE_MAX_NONCE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  431   unsigned int enc_keylen = 
ctx->enc_keylen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  432   unsigned int auth_keylen = 
ctx->auth_keylen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  433   unsigned int enc_ivsize = 
rctx->ivsize;
b152c1b17bb6ad Thara Gopinath 2021-04-19  434   unsigned int auth_ivsize;
b152c1b17bb6ad Thara Gopinath 2021-04-19  435   unsigned int enckey_words, 
enciv_words;
b152c1b17bb6ad Thara Gopinath 2021-04-19  436   unsigned int authkey_words, 
authiv_words, authnonce_words;
b152c1b17bb6ad Thara Gopinath 2021-04-19  437   unsigned long flags = 
rctx->flags;
b152c1b17bb6ad Thara Gopinath 2021-04-19  438   u32 encr_cfg, auth_cfg, config, 
totallen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  439   u32 iv_last_word;
b152c1b17bb6ad Thara Gopinath 2021-04-19  440  
b152c1b17bb6ad Thara Gopinath 2021-04-19  441   qce_setup_config(qce);
b152c1b17bb6ad Thara Gopinath 2021-04-19  442  
b152c1b17bb6ad Thara Gopinath 2021-04-19  443   /* Write encryption key */
b152c1b17bb6ad Thara Gopinath 2021-04-19  444   enckey_words = 
qce_be32_to_cpu_array(enckey, ctx->enc_key, enc_keylen);
b152c1b17bb6ad Thara Gopinath 2021-04-19  445   qce_write_array(qce, 
REG_ENCR_KEY0, enckey, enckey_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  446  
b152c1b17bb6ad Thara Gopinath 2021-04-19  447   /* Write encryption iv */
b152c1b17bb6ad Thara Gopinath 2021-04-19  448   enciv_words = 
qce_be32_to_cpu_array(enciv, rctx->iv, enc_ivsize);
b152c1b17bb6ad Thara Gopinath 2021-04-19  449   qce_write_array(qce, 
REG_CNTR0_IV0, enciv, enciv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  450  
b152c1b17bb6ad Thara Gopinath 2021-04-19  451   if (IS_CCM(rctx->flags)) {
b152c1b17bb6ad Thara Gopinath 2021-04-19  452   iv_last_word = 
enciv[enciv_words - 1];
b152c1b17bb6ad Thara Gopinath 2021-04-19  453   qce_write(qce, 
REG_CNTR3_IV3, iv_last_word + 1);
b152c1b17bb6ad Thara Gopinath 2021-04-19  454   qce_write_array(qce, 
REG_ENCR_CCM_INT_CNTR0, (u32 *)enciv, enciv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  455   qce_write(qce, 
REG_CNTR_MASK, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  456   qce_write(qce, 
REG_CNTR_MASK0, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  457   qce_write(qce, 
REG_CNTR_MASK1, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  458   qce_write(qce, 
REG_CNTR_MASK2, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  459   }
b152c1b17bb6ad Thara Gopinath 2021-04-19  460  
b152c1b17bb6ad Thara Gopinath 2021-04-19  461   /* Clear authentication IV and 
KEY registers of previous values */
b152c1b17bb6ad Thara Gopinath 2021-04-19  462   qce_clear_array(qce, 
REG_AUTH_IV0, 16);
b152c1b17bb6ad Thara Gopinath 2021-04-19  463   qce_clear_array(qce, 
REG_AUTH_KEY0, 16);
b152c1b17bb6ad Thara Gopinath 2021-04-19  464  
b152c1b17bb6ad Thara Gopinath 2021-04-19  465   /* Clear byte count */
b152c1b17bb6ad Thara Gopinath 2021-04-19  466   qce_clear_array(qce, 
REG_AUTH_BYTECNT0, 4);
b152c1b17bb6ad Thara Gopinath 2021-04-19  467  
b152c1b17bb6ad Thara Gopinath 2021-04-19  46

[kbuild] Re: drivers/iommu/arm/arm-smmu/qcom_iommu.c:248 qcom_iommu_init_domain() warn: missing error code 'ret'

2021-04-28 Thread Dan Carpenter
Oops, sorry.  I didn't mean to sent that.

regards,
dan carpenter

On Wed, Apr 28, 2021 at 02:26:51PM +0300, Dan Carpenter wrote:
> CC: kbuild-...@lists.01.org
> CC: linux-ker...@vger.kernel.org
> TO: Will Deacon 
> 
> Hi Will,
> 
> First bad commit (maybe != root cause):
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   9f4ad9e425a1d3b6a34617b8ea226d56a119a717
> commit: e86d1aa8b60f7ea18d36f50296d7d20eb2852e7e iommu/arm-smmu: Move Arm 
> SMMU drivers into their own subdirectory
> date:   9 months ago
> config: i386-randconfig-m021-20210426 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot 
> Reported-by: Dan Carpenter 
> 
> smatch warnings:
> drivers/iommu/arm/arm-smmu/qcom_iommu.c:248 qcom_iommu_init_domain() warn: 
> missing error code 'ret'
> 
> vim +/ret +248 drivers/iommu/arm/arm-smmu/qcom_iommu.c
> 
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  234  
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  235  
> static int qcom_iommu_init_domain(struct iommu_domain *domain,
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  236
>   struct qcom_iommu_dev *qcom_iommu,
> 09b5dfff9ad68f drivers/iommu/qcom_iommu.c Joerg Roedel 2020-03-26  237
>   struct device *dev)
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  238  {
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  239
> struct qcom_iommu_domain *qcom_domain = to_qcom_iommu_domain(domain);
> 09b5dfff9ad68f drivers/iommu/qcom_iommu.c Joerg Roedel 2020-03-26  240
> struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  241
> struct io_pgtable_ops *pgtbl_ops;
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  242
> struct io_pgtable_cfg pgtbl_cfg;
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  243
> int i, ret = 0;
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  244
> u32 reg;
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  245  
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  246
> mutex_lock(_domain->init_mutex);
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  247
> if (qcom_domain->iommu)
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09 @248
> goto out_unlock;
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  249  
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  250
> pgtbl_cfg = (struct io_pgtable_cfg) {
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  251
> .pgsize_bitmap  = qcom_iommu_ops.pgsize_bitmap,
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  252
> .ias= 32,
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  253
> .oas= 40,
> 298f78895b0819 drivers/iommu/qcom_iommu.c Will Deacon  2019-07-02  254
> .tlb= _flush_ops,
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  255
> .iommu_dev  = qcom_iommu->dev,
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  256
> };
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  257  
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  258
> qcom_domain->iommu = qcom_iommu;
> 09b5dfff9ad68f drivers/iommu/qcom_iommu.c Joerg Roedel 2020-03-26  259
> pgtbl_ops = alloc_io_pgtable_ops(ARM_32_LPAE_S1, _cfg, dev);
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  260
> if (!pgtbl_ops) {
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  261
> dev_err(qcom_iommu->dev, "failed to allocate pagetable ops\n");
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  262
> ret = -ENOMEM;
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  263
> goto out_clear_iommu;
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  264
> }
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  265  
> 0ae349a0f33fb0 drivers/iommu/qcom_iommu.c Rob Clark2017-08-09  266
> /* Update the domain's page sizes to reflect the page table format */
> 0ae349a0f33fb0 

[kbuild] [block:for-5.13/io_uring 143/149] fs/io_uring.c:8234 io_sqe_buffer_register() warn: this array is probably non-NULL. 'imu->bvec'

2021-04-28 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
for-5.13/io_uring
head:   a2a7cc32a5e8cd983912f25a242820107e5613dc
commit: 41edf1a5ec967bf4bddedb83c48e02dfea8315b4 [143/149] io_uring: keep table 
of pointers to ubufs
config: x86_64-randconfig-m031-20210425 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
fs/io_uring.c:8234 io_sqe_buffer_register() warn: this array is probably 
non-NULL. 'imu->bvec'

Old smatch warnings:
fs/io_uring.c:4639 io_recv() error: uninitialized symbol 'flags'.
fs/io_uring.c:4934 io_poll_double_wake() warn: variable dereferenced before 
check 'poll' (see line 4929)

vim +8234 fs/io_uring.c

0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8205  static int 
io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov,
41edf1a5ec967b Pavel Begunkov2021-04-25  8206   
  struct io_mapped_ubuf **pimu,
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8207   
  struct page **last_hpage)
edafccee56ff31 Jens Axboe2019-01-09  8208  {
41edf1a5ec967b Pavel Begunkov2021-04-25  8209   struct io_mapped_ubuf 
*imu = NULL;
edafccee56ff31 Jens Axboe2019-01-09  8210   struct vm_area_struct 
**vmas = NULL;
edafccee56ff31 Jens Axboe2019-01-09  8211   struct page **pages = 
NULL;
edafccee56ff31 Jens Axboe2019-01-09  8212   unsigned long off, 
start, end, ubuf;
edafccee56ff31 Jens Axboe2019-01-09  8213   size_t size;
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8214   int ret, pret, 
nr_pages, i;
edafccee56ff31 Jens Axboe2019-01-09  8215  
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8216   ubuf = (unsigned long) 
iov->iov_base;
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8217   end = (ubuf + 
iov->iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT;
edafccee56ff31 Jens Axboe2019-01-09  8218   start = ubuf >> 
PAGE_SHIFT;
edafccee56ff31 Jens Axboe2019-01-09  8219   nr_pages = end - start;
edafccee56ff31 Jens Axboe2019-01-09  8220  
41edf1a5ec967b Pavel Begunkov2021-04-25  8221   *pimu = NULL;
edafccee56ff31 Jens Axboe2019-01-09  8222   ret = -ENOMEM;
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8223  
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8224   pages = 
kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL);
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8225   if (!pages)
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8226   goto done;
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8227  
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8228   vmas = 
kvmalloc_array(nr_pages, sizeof(struct vm_area_struct *),
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8229 
GFP_KERNEL);
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8230   if (!vmas)
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8231   goto done;
edafccee56ff31 Jens Axboe2019-01-09  8232  
41edf1a5ec967b Pavel Begunkov2021-04-25  8233   imu = 
kvmalloc(struct_size(imu, bvec, nr_pages), GFP_KERNEL);
de2939388be564 Jens Axboe2020-09-17 @8234   if (!imu->bvec)

This should be "if (!imu)"

0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8235   goto done;
edafccee56ff31 Jens Axboe2019-01-09  8236  
edafccee56ff31 Jens Axboe2019-01-09  8237   ret = 0;
d8ed45c5dcd455 Michel Lespinasse 2020-06-08  8238   
mmap_read_lock(current->mm);
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8239   pret = 
pin_user_pages(ubuf, nr_pages, FOLL_WRITE | FOLL_LONGTERM,
edafccee56ff31 Jens Axboe2019-01-09  8240 
pages, vmas);
edafccee56ff31 Jens Axboe2019-01-09  8241   if (pret == nr_pages) {
edafccee56ff31 Jens Axboe2019-01-09  8242   /* don't 
support file backed memory */
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8243   for (i = 0; i < 
nr_pages; i++) {
0a96bbe49994a4 Bijan Mottahedeh  2021-01-06  8244   struct 
vm_area_struct *vma = vmas[i];
edafccee56ff31 Jens Axboe2019-01-09  8245  
edafccee56ff31 Jens Axboe2019-01-09  8246   if 
(vma->vm_file &&
edafccee56ff31 Jens Axboe2019-01-09  8247   
!is_file_hugepages(vma->vm_file)) {
edafccee56ff31 Jens Axboe2019-01-09  8248   
ret = -EOPNOTSUPP;
edafccee56ff31 Jens Axboe2019-01-09  8249   
break;
edafccee56ff31 Jens Axboe2019-01-09  8250   }
edafccee56ff31 Jens Axboe2019-01-09  8251   }
edafccee56ff31 Jens Axboe2019-01-09  8252   } else {
edafccee56ff31 Jens Axboe2019-01-0

[kbuild] [sashal-linux-stable:queue-4.9 26/29] drivers/usb/usbip/vudc_sysfs.c:238 store_sockfd() warn: inconsistent returns '>ud.sysfs_lock'.

2021-04-28 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git 
queue-4.9
head:   7edb2da8d62438a92699cb11688ad9f372fc32fc
commit: 117246f8e1e52f36549f8e420418f4673d4ddca2 [26/29] usbip: vudc 
synchronize sysfs code paths
config: arc-randconfig-m031-20210425 (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/usb/usbip/vudc_sysfs.c:238 store_sockfd() warn: inconsistent returns 
'>ud.sysfs_lock'.

vim +238 drivers/usb/usbip/vudc_sysfs.c

fe9e15a30be666 Shuah Khan   2021-03-07  106  static ssize_t 
store_sockfd(struct device *dev,
fe9e15a30be666 Shuah Khan   2021-03-07  107 
 struct device_attribute *attr,
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  108 
 const char *in, size_t count)
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  109  {
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  110 struct vudc *udc = 
(struct vudc *) dev_get_drvdata(dev);
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  111 int rv;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  112 int sockfd = 0;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  113 int err;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  114 struct socket *socket;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  115 unsigned long flags;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  116 int ret;
fe9e15a30be666 Shuah Khan   2021-03-07  117 struct task_struct 
*tcp_rx = NULL;
fe9e15a30be666 Shuah Khan   2021-03-07  118 struct task_struct 
*tcp_tx = NULL;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  119  
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  120 rv = kstrtoint(in, 0, 
);
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  121 if (rv != 0)
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  122 return -EINVAL;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  123  
b7661e9af851da Colin Ian King   2018-02-22  124 if (!udc) {
b7661e9af851da Colin Ian King   2018-02-22  125 dev_err(dev, 
"no device");
b7661e9af851da Colin Ian King   2018-02-22  126 return -ENODEV;
b7661e9af851da Colin Ian King   2018-02-22  127 }
117246f8e1e52f Shuah Khan   2021-04-16  128 
mutex_lock(>ud.sysfs_lock);

^^^

ea6873a45a22f3 Igor Kotrasinski 2016-03-08  129 
spin_lock_irqsave(>lock, flags);
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  130 /* Don't export what we 
don't have */
b7661e9af851da Colin Ian King   2018-02-22  131 if (!udc->driver || 
!udc->pullup) {
b7661e9af851da Colin Ian King   2018-02-22  132 dev_err(dev, 
"gadget not bound");
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  133 ret = -ENODEV;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  134 goto unlock;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  135 }
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  136  
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  137 if (sockfd != -1) {
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  138 if 
(udc->connected) {
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  139 
dev_err(dev, "Device already connected");
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  140 ret = 
-EBUSY;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  141 goto 
unlock;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  142 }
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  143  
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  144 
spin_lock_irq(>ud.lock);
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  145  
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  146 if 
(udc->ud.status != SDEV_ST_AVAILABLE) {
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  147 ret = 
-EINVAL;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  148 goto 
unlock_ud;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  149 }
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  150  
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  151 socket = 
sockfd_lookup(sockfd, );
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  152 if (!socket) {
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  153 
dev_err(dev, "failed to lookup sock");
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  154 ret = 
-EINVAL;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  155 goto 
unlock_ud;
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  156 }
ea6873a45a22f3 Igor Kotrasinski 2016-03-08  157  
d5708a353836ac Shuah Khan   2021-03-07  158 if 
(socket->typ

[kbuild] drivers/usb/cdns3/cdnsp-mem.c:1076 cdnsp_mem_cleanup() warn: variable dereferenced before check 'pdev->dcbaa' (see line 1058)

2021-04-28 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   5bfc75d92efd494db37f5c4c173d3639d4772966
commit: 3d82904559f4f5a2622db1b21de3edf2eded7664 usb: cdnsp: cdns3 Add main 
part of Cadence USBSSP DRD Driver
config: ia64-randconfig-m031-20210423 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/usb/cdns3/cdnsp-mem.c:1076 cdnsp_mem_cleanup() warn: variable 
dereferenced before check 'pdev->dcbaa' (see line 1058)

vim +1076 drivers/usb/cdns3/cdnsp-mem.c

3d82904559f4f5 Pawel Laszczak 2020-12-07  1054  void cdnsp_mem_cleanup(struct 
cdnsp_device *pdev)
3d82904559f4f5 Pawel Laszczak 2020-12-07  1055  {
3d82904559f4f5 Pawel Laszczak 2020-12-07  1056  struct device *dev = 
pdev->dev;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1057  
3d82904559f4f5 Pawel Laszczak 2020-12-07 @1058  
cdnsp_free_priv_device(pdev);

^
Dereferences "pdev->dcbaa" without checking

3d82904559f4f5 Pawel Laszczak 2020-12-07  1059  cdnsp_free_erst(pdev, 
>erst);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1060  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1061  if (pdev->event_ring)
3d82904559f4f5 Pawel Laszczak 2020-12-07  1062  
cdnsp_ring_free(pdev, pdev->event_ring);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1063  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1064  pdev->event_ring = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1065  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1066  if (pdev->cmd_ring)
3d82904559f4f5 Pawel Laszczak 2020-12-07  1067  
cdnsp_ring_free(pdev, pdev->cmd_ring);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1068  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1069  pdev->cmd_ring = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1070  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1071  
dma_pool_destroy(pdev->segment_pool);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1072  pdev->segment_pool = 
NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1073  
dma_pool_destroy(pdev->device_pool);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1074  pdev->device_pool = 
NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1075  
3d82904559f4f5 Pawel Laszczak 2020-12-07 @1076  if (pdev->dcbaa)
^^^
Too late

3d82904559f4f5 Pawel Laszczak 2020-12-07  1077  
dma_free_coherent(dev, sizeof(*pdev->dcbaa),
3d82904559f4f5 Pawel Laszczak 2020-12-07  1078  
  pdev->dcbaa, pdev->dcbaa->dma);
3d82904559f4f5 Pawel Laszczak 2020-12-07  1079  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1080  pdev->dcbaa = NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1081  
3d82904559f4f5 Pawel Laszczak 2020-12-07  1082  pdev->usb2_port.exist = 
0;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1083  pdev->usb3_port.exist = 
0;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1084  
pdev->usb2_port.port_num = 0;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1085  
pdev->usb3_port.port_num = 0;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1086  pdev->active_port = 
NULL;
3d82904559f4f5 Pawel Laszczak 2020-12-07  1087  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH] [net-next] net: stmmac: fix gcc-10 -Wrestrict warning

2021-04-23 Thread Dan Carpenter
Hi Arnd,

url:
https://github.com/0day-ci/linux/commits/Arnd-Bergmann/net-stmmac-fix-gcc-10-Wrestrict-warning/20210421-215015
base:b74523885a715463203d4ccc3cf8c85952d3701a
config: x86_64-randconfig-m001-20210421 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3503 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->rx_irq' 8 <= 8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3506 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->int_name_rx_irq' 8 
<= 8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3528 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->tx_irq' 8 <= 8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3531 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->int_name_tx_irq' 8 
<= 8

Old smatch warnings:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1708 init_dma_rx_desc_rings() 
warn: always true condition '(queue >= 0) => (0-u32max >= 0)'
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1708 init_dma_rx_desc_rings() 
warn: always true condition '(queue >= 0) => (0-u32max >= 0)'
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3508 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->rx_irq' 8 <= 8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3514 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->rx_irq' 8 <= 8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3521 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->rx_irq' 8 <= 8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3533 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->tx_irq' 8 <= 8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3539 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->tx_irq' 8 <= 8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:3546 
stmmac_request_irq_multi_msi() error: buffer overflow 'priv->tx_irq' 8 <= 8

vim +3503 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

8532f613bc78b6 Ong Boon Leong 2021-03-26  3404  static int 
stmmac_request_irq_multi_msi(struct net_device *dev)
8532f613bc78b6 Ong Boon Leong 2021-03-26  3405  {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3406  enum request_irq_err 
irq_err = REQ_IRQ_ERR_NO;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3407  struct stmmac_priv 
*priv = netdev_priv(dev);
8deec94c6040bb Ong Boon Leong 2021-04-01  3408  cpumask_t cpu_mask;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3409  int irq_idx = 0;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3410  char *int_name;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3411  int ret;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3412  int i;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3413  
8532f613bc78b6 Ong Boon Leong 2021-03-26  3414  /* For common interrupt 
*/
8532f613bc78b6 Ong Boon Leong 2021-03-26  3415  int_name = 
priv->int_name_mac;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3416  sprintf(int_name, 
"%s:%s", dev->name, "mac");
8532f613bc78b6 Ong Boon Leong 2021-03-26  3417  ret = 
request_irq(dev->irq, stmmac_mac_interrupt,
8532f613bc78b6 Ong Boon Leong 2021-03-26  34180, 
int_name, dev);
8532f613bc78b6 Ong Boon Leong 2021-03-26  3419  if (unlikely(ret < 0)) {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3420  
netdev_err(priv->dev,
8532f613bc78b6 Ong Boon Leong 2021-03-26  3421 "%s: 
alloc mac MSI %d (error: %d)\n",
8532f613bc78b6 Ong Boon Leong 2021-03-26  3422 
__func__, dev->irq, ret);
8532f613bc78b6 Ong Boon Leong 2021-03-26  3423  irq_err = 
REQ_IRQ_ERR_MAC;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3424  goto irq_error;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3425  }
8532f613bc78b6 Ong Boon Leong 2021-03-26  3426  
8532f613bc78b6 Ong Boon Leong 2021-03-26  3427  /* Request the Wake IRQ 
in case of another line
8532f613bc78b6 Ong Boon Leong 2021-03-26  3428   * is used for WoL
8532f613bc78b6 Ong Boon Leong 2021-03-26  3429   */
8532f613bc78b6 Ong Boon Leong 2021-03-26  3430  if (priv->wol_irq > 0 
&& priv->wol_irq != dev->irq) {
8532f613bc78b6 Ong Boon Leong 2021-03-26  3431  int_name = 
priv->int_name_wol;
8532f613bc78b6 Ong Boon Leong 2021-03-26  3432  
sprintf(int_name, "%s:%s", dev->name, "wol");
8532f613bc78b6 Ong Boon Leong 2021-03-26  3433  ret = 
request_irq(priv->wol_irq,
8532f613bc78b6 Ong Boon Leong 2021-03-26  3434  
  stmmac_mac_interrupt,
8532f613bc78

[kbuild] [hare-scsi-devel:scsi-result-rework 8/146] drivers/scsi/sg.c:501 sg_read() warn: this array is probably non-NULL. 'srp->sense_b'

2021-04-23 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git 
scsi-result-rework
head:   19720ea7b22b443a182646eef7edc36e32e7b515
commit: 650e66d86e623824cc550f1b8411951116a6b6ea [8/146] scsi: Kill DRIVER_SENSE
config: i386-randconfig-m021-20210421 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/scsi/sg.c:501 sg_read() warn: this array is probably non-NULL. 
'srp->sense_b'
drivers/scsi/sg.c:579 sg_new_read() warn: this array is probably non-NULL. 
'srp->sense_b'

Old smatch warnings:
drivers/scsi/sg.c:484 sg_read() error: we previously assumed 'srp' could be 
null (see line 470)
drivers/scsi/sg.c:1100 sg_ioctl_common() warn: inconsistent indenting

vim +501 drivers/scsi/sg.c

^1da177e4c3f41 Linus Torvalds  2005-04-16  440  static ssize_t
^1da177e4c3f41 Linus Torvalds  2005-04-16  441  sg_read(struct file *filp, char 
__user *buf, size_t count, loff_t * ppos)
^1da177e4c3f41 Linus Torvalds  2005-04-16  442  {
^1da177e4c3f41 Linus Torvalds  2005-04-16  443  Sg_device *sdp;
^1da177e4c3f41 Linus Torvalds  2005-04-16  444  Sg_fd *sfp;
^1da177e4c3f41 Linus Torvalds  2005-04-16  445  Sg_request *srp;
^1da177e4c3f41 Linus Torvalds  2005-04-16  446  int req_pack_id = -1;
^1da177e4c3f41 Linus Torvalds  2005-04-16  447  sg_io_hdr_t *hp;
78ed001d9e7106 Arnd Bergmann   2019-12-04  448  struct sg_header 
*old_hdr;
78ed001d9e7106 Arnd Bergmann   2019-12-04  449  int retval;
^1da177e4c3f41 Linus Torvalds  2005-04-16  450  
26b5b874aff565 Jann Horn   2018-06-25  451  /*
26b5b874aff565 Jann Horn   2018-06-25  452   * This could cause a 
response to be stranded. Close the associated
26b5b874aff565 Jann Horn   2018-06-25  453   * file descriptor to 
free up any resources being held.
26b5b874aff565 Jann Horn   2018-06-25  454   */
26b5b874aff565 Jann Horn   2018-06-25  455  retval = 
sg_check_file_access(filp, __func__);
26b5b874aff565 Jann Horn   2018-06-25  456  if (retval)
26b5b874aff565 Jann Horn   2018-06-25  457  return retval;
26b5b874aff565 Jann Horn   2018-06-25  458  
^1da177e4c3f41 Linus Torvalds  2005-04-16  459  if ((!(sfp = (Sg_fd *) 
filp->private_data)) || (!(sdp = sfp->parentdp)))
^1da177e4c3f41 Linus Torvalds  2005-04-16  460  return -ENXIO;
95e159d6dd808b Hannes Reinecke 2014-06-25  461  SCSI_LOG_TIMEOUT(3, 
sg_printk(KERN_INFO, sdp,
95e159d6dd808b Hannes Reinecke 2014-06-25  462  
  "sg_read: count=%d\n", (int) count));
d6b10348f93979 Mike Christie   2005-11-08  463  
78ed001d9e7106 Arnd Bergmann   2019-12-04  464  if (sfp->force_packid)
78ed001d9e7106 Arnd Bergmann   2019-12-04  465  retval = 
get_sg_io_pack_id(_pack_id, buf, count);
78ed001d9e7106 Arnd Bergmann   2019-12-04  466  if (retval)
78ed001d9e7106 Arnd Bergmann   2019-12-04  467  return retval;
78ed001d9e7106 Arnd Bergmann   2019-12-04  468  
^1da177e4c3f41 Linus Torvalds  2005-04-16  469  srp = 
sg_get_rq_mark(sfp, req_pack_id);
^1da177e4c3f41 Linus Torvalds  2005-04-16  470  if (!srp) { 
/* now wait on packet to arrive */
78ed001d9e7106 Arnd Bergmann   2019-12-04  471  if 
(atomic_read(>detaching))
78ed001d9e7106 Arnd Bergmann   2019-12-04  472  return 
-ENODEV;
78ed001d9e7106 Arnd Bergmann   2019-12-04  473  if 
(filp->f_flags & O_NONBLOCK)
78ed001d9e7106 Arnd Bergmann   2019-12-04  474  return 
-EAGAIN;
3f0c6aba0b65a6 Jörn Engel  2012-04-12  475  retval = 
wait_event_interruptible(sfp->read_wait,
cc833acbee9db5 Douglas Gilbert 2014-06-25  476  
(atomic_read(>detaching) ||
3f0c6aba0b65a6 Jörn Engel  2012-04-12  477  (srp = 
sg_get_rq_mark(sfp, req_pack_id;
78ed001d9e7106 Arnd Bergmann   2019-12-04  478  if 
(atomic_read(>detaching))
78ed001d9e7106 Arnd Bergmann   2019-12-04  479  return 
-ENODEV;
78ed001d9e7106 Arnd Bergmann   2019-12-04  480  if (retval)
cb59e840838193 Douglas Gilbert 2005-04-02  481  /* 
-ERESTARTSYS as signal hit process */
78ed001d9e7106 Arnd Bergmann   2019-12-04  482  return 
retval;
^1da177e4c3f41 Linus Torvalds  2005-04-16  483  }
78ed001d9e7106 Arnd Bergmann   2019-12-04  484  if 
(srp->header.interface_id != '\0')
78ed001d9e7106 Arnd Bergmann   2019-12-04  485  return 
sg_new_read(sfp, buf, count, srp);
^1da177e4c3f41 Linus Torvalds  2005-04-16  486  
^1da177e4c3f41 Linus Torvalds  2005-04-16  487  hp = >

[kbuild] Re: [PATCH RESEND-2 RFC net-next 12/18] devlink: Introduce rate nodes

2021-04-23 Thread Dan Carpenter
Hi,

url:
https://github.com/0day-ci/linux/commits/dlinkin-nvidia-com/devlink-rate-objects-API/20210421-235552
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
a926c025d56bb1acd8a192fca0e307331ee91b30
config: x86_64-randconfig-m001-20210421 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
net/core/devlink.c:1591 devlink_nl_rate_set() error: uninitialized symbol 'err'.

Old smatch warnings:
net/core/devlink.c:1604 devlink_nl_rate_set() error: uninitialized symbol 'err'.
net/core/devlink.c:6364 devlink_fmsg_prepare_skb() error: uninitialized symbol 
'err'.

vim +/err +1591 net/core/devlink.c

709d06045321cd Dmytro Linkin 2021-04-21  1575  static int 
devlink_nl_rate_set(struct devlink_rate *devlink_rate,
709d06045321cd Dmytro Linkin 2021-04-21  1576  const 
struct devlink_ops *ops,
709d06045321cd Dmytro Linkin 2021-04-21  1577  struct 
genl_info *info)
709d06045321cd Dmytro Linkin 2021-04-21  1578  {
709d06045321cd Dmytro Linkin 2021-04-21  1579   struct nlattr **attrs = 
info->attrs;
709d06045321cd Dmytro Linkin 2021-04-21  1580   u64 rate;
709d06045321cd Dmytro Linkin 2021-04-21  1581   int err;
709d06045321cd Dmytro Linkin 2021-04-21  1582  
709d06045321cd Dmytro Linkin 2021-04-21  1583   if 
(attrs[DEVLINK_ATTR_RATE_TX_SHARE]) {
709d06045321cd Dmytro Linkin 2021-04-21  1584   rate = 
nla_get_u64(attrs[DEVLINK_ATTR_RATE_TX_SHARE]);
ddc9bb1d01c107 Dmytro Linkin 2021-04-21  1585   if 
(devlink_rate_is_leaf(devlink_rate))
709d06045321cd Dmytro Linkin 2021-04-21  1586   err = 
ops->rate_leaf_tx_share_set(devlink_rate, devlink_rate->priv,
709d06045321cd Dmytro Linkin 2021-04-21  1587   
  rate, info->extack);
ddc9bb1d01c107 Dmytro Linkin 2021-04-21  1588   else if 
(devlink_rate_is_node(devlink_rate))
ddc9bb1d01c107 Dmytro Linkin 2021-04-21  1589   err = 
ops->rate_node_tx_share_set(devlink_rate, devlink_rate->priv,
ddc9bb1d01c107 Dmytro Linkin 2021-04-21  1590   
  rate, info->extack);

No else path.  Is there something else besides leafs and nodes?

709d06045321cd Dmytro Linkin 2021-04-21 @1591   if (err)
709d06045321cd Dmytro Linkin 2021-04-21  1592   return err;
709d06045321cd Dmytro Linkin 2021-04-21  1593   devlink_rate->tx_share 
= rate;
709d06045321cd Dmytro Linkin 2021-04-21  1594   }
709d06045321cd Dmytro Linkin 2021-04-21  1595  
709d06045321cd Dmytro Linkin 2021-04-21  1596   if 
(attrs[DEVLINK_ATTR_RATE_TX_MAX]) {
709d06045321cd Dmytro Linkin 2021-04-21  1597   rate = 
nla_get_u64(attrs[DEVLINK_ATTR_RATE_TX_MAX]);
ddc9bb1d01c107 Dmytro Linkin 2021-04-21  1598   if 
(devlink_rate_is_leaf(devlink_rate))
709d06045321cd Dmytro Linkin 2021-04-21  1599   err = 
ops->rate_leaf_tx_max_set(devlink_rate, devlink_rate->priv,
709d06045321cd Dmytro Linkin 2021-04-21  1600   
rate, info->extack);
ddc9bb1d01c107 Dmytro Linkin 2021-04-21  1601   else if 
(devlink_rate_is_node(devlink_rate))
ddc9bb1d01c107 Dmytro Linkin 2021-04-21  1602   err = 
ops->rate_node_tx_max_set(devlink_rate, devlink_rate->priv,
ddc9bb1d01c107 Dmytro Linkin 2021-04-21  1603   
rate, info->extack);
709d06045321cd Dmytro Linkin 2021-04-21  1604   if (err)
709d06045321cd Dmytro Linkin 2021-04-21  1605   return err;
709d06045321cd Dmytro Linkin 2021-04-21  1606   devlink_rate->tx_max = 
rate;
709d06045321cd Dmytro Linkin 2021-04-21  1607   }
709d06045321cd Dmytro Linkin 2021-04-21  1608  
709d06045321cd Dmytro Linkin 2021-04-21  1609   return 0;
709d06045321cd Dmytro Linkin 2021-04-21  1610  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] [freescale-fslc:5.4-2.3.x-imx 14423/18271] drivers/misc/mic/host/mic_main.c:209 mic_probe() warn: missing error code 'rc'

2021-04-23 Thread Dan Carpenter
tree:   https://github.com/Freescale/linux-fslc  5.4-2.3.x-imx
head:   e67919750cd7d48b9321b79dbbc6d0709e5b53df
commit: c27a982e3ef1422c74ca1b628a6b35118e6a3ed8 [14423/18271] MLK-24935-2 
misc: vop: use dma_alloc_coherent to allocate vrings and device page directly
config: x86_64-randconfig-m001-20210421 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/misc/mic/host/mic_main.c:209 mic_probe() warn: missing error code 'rc'

vim +/rc +209 drivers/misc/mic/host/mic_main.c

b170d8ce3f81bd Sudeep Dutt 2013-09-05  132  static int 
mic_probe(struct pci_dev *pdev,
b170d8ce3f81bd Sudeep Dutt 2013-09-05  133   
const struct pci_device_id *ent)
b170d8ce3f81bd Sudeep Dutt 2013-09-05  134  {
b170d8ce3f81bd Sudeep Dutt 2013-09-05  135  int rc;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  136  struct 
mic_device *mdev;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  137  
b170d8ce3f81bd Sudeep Dutt 2013-09-05  138  mdev = 
kzalloc(sizeof(*mdev), GFP_KERNEL);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  139  if (!mdev) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05  140  rc = 
-ENOMEM;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  141  
dev_err(>dev, "mdev kmalloc failed rc %d\n", rc);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  142  goto 
mdev_alloc_fail;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  143  }
b170d8ce3f81bd Sudeep Dutt 2013-09-05  144  mdev->id = 
ida_simple_get(_mic_ida, 0, MIC_MAX_NUM_DEVS, GFP_KERNEL);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  145  if (mdev->id < 
0) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05  146  rc = 
mdev->id;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  147  
dev_err(>dev, "ida_simple_get failed rc %d\n", rc);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  148  goto 
ida_fail;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  149  }
b170d8ce3f81bd Sudeep Dutt 2013-09-05  150  
1da2b3eeef3667 Ashutosh Dixit  2015-09-29  151  
mic_device_init(mdev, pdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  152  
b170d8ce3f81bd Sudeep Dutt 2013-09-05  153  rc = 
pci_enable_device(pdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  154  if (rc) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05  155  
dev_err(>dev, "failed to enable pci device.\n");
1da2b3eeef3667 Ashutosh Dixit  2015-09-29  156  goto 
ida_remove;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  157  }
b170d8ce3f81bd Sudeep Dutt 2013-09-05  158  
b170d8ce3f81bd Sudeep Dutt 2013-09-05  159  
pci_set_master(pdev);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  160  
b170d8ce3f81bd Sudeep Dutt 2013-09-05  161  rc = 
pci_request_regions(pdev, mic_driver_name);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  162  if (rc) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05  163  
dev_err(>dev, "failed to get pci regions.\n");
b170d8ce3f81bd Sudeep Dutt 2013-09-05  164  goto 
disable_device;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  165  }
b170d8ce3f81bd Sudeep Dutt 2013-09-05  166  
b170d8ce3f81bd Sudeep Dutt 2013-09-05  167  rc = 
pci_set_dma_mask(pdev, DMA_BIT_MASK(64));
b170d8ce3f81bd Sudeep Dutt 2013-09-05  168  if (rc) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05  169  
dev_err(>dev, "Cannot set DMA mask\n");
b170d8ce3f81bd Sudeep Dutt 2013-09-05  170  goto 
release_regions;
b170d8ce3f81bd Sudeep Dutt 2013-09-05  171  }
b170d8ce3f81bd Sudeep Dutt 2013-09-05  172  
b170d8ce3f81bd Sudeep Dutt 2013-09-05  173  mdev->mmio.pa = 
pci_resource_start(pdev, mdev->ops->mmio_bar);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  174  mdev->mmio.len 
= pci_resource_len(pdev, mdev->ops->mmio_bar);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  175  mdev->mmio.va = 
pci_ioremap_bar(pdev, mdev->ops->mmio_bar);
b170d8ce3f81bd Sudeep Dutt 2013-09-05  176  if 
(!mdev->mmio.va) {
b170d8ce3f81bd Sudeep Dutt 2013-09-05  177  
dev_err(>dev, "Cannot remap MMIO BAR\n");
b170d8ce3f81bd Sudeep Dutt 2013-09-05  178  rc = 
-EIO;
b

[kbuild] [saeed:mlx5-queue 1823/1834] drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:2956 mlx5_init_fs() warn: missing error code 'err'

2021-04-22 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git  
mlx5-queue
head:   7cb88bf45e588520c8743125cfda21d74de95639
commit: 5de5d1022d1529c26a8a64973edbeb5897762136 [1823/1834] net/mlx5: Move 
chains ft pool to be used by all firmware steering
config: x86_64-randconfig-m001-20210421 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:2956 mlx5_init_fs() warn: 
missing error code 'err'

Old smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c:1625 dest_is_valid() error: 
we previously assumed 'dest' could be null (see line 1614)

vim +/err +2956 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

2530236303d9e7 Maor Gottlieb 2015-12-10  2941  int mlx5_init_fs(struct 
mlx5_core_dev *dev)
2530236303d9e7 Maor Gottlieb 2015-12-10  2942  {
fba53f7b571925 Maor Gottlieb 2016-07-04  2943   struct 
mlx5_flow_steering *steering;
2530236303d9e7 Maor Gottlieb 2015-12-10  2944   int err = 0;
2530236303d9e7 Maor Gottlieb 2015-12-10  2945  
43a335e055bb7e Amir Vadai2016-05-13  2946   err = 
mlx5_init_fc_stats(dev);
43a335e055bb7e Amir Vadai2016-05-13  2947   if (err)
43a335e055bb7e Amir Vadai2016-05-13  2948   return err;
43a335e055bb7e Amir Vadai2016-05-13  2949  
5de5d1022d1529 Paul Blakey   2021-03-08  2950   err = 
mlx5_ft_pool_init(dev);
5de5d1022d1529 Paul Blakey   2021-03-08  2951   if (err)
5de5d1022d1529 Paul Blakey   2021-03-08  2952   return err;
5de5d1022d1529 Paul Blakey   2021-03-08  2953  
fba53f7b571925 Maor Gottlieb 2016-07-04  2954   steering = 
kzalloc(sizeof(*steering), GFP_KERNEL);
fba53f7b571925 Maor Gottlieb 2016-07-04  2955   if (!steering)
5de5d1022d1529 Paul Blakey   2021-03-08 @2956   goto err;

Needs an "err = -ENOMEM;"

fba53f7b571925 Maor Gottlieb 2016-07-04  2957   steering->dev = dev;
fba53f7b571925 Maor Gottlieb 2016-07-04  2958   dev->priv.steering = 
steering;
fba53f7b571925 Maor Gottlieb 2016-07-04  2959  
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2960   steering->fgs_cache = 
kmem_cache_create("mlx5_fs_fgs",
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2961   
sizeof(struct mlx5_flow_group), 0,
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2962   
0, NULL);
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2963   steering->ftes_cache = 
kmem_cache_create("mlx5_fs_ftes", sizeof(struct fs_fte), 0,
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2964   
 0, NULL);
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2965   if 
(!steering->ftes_cache || !steering->fgs_cache) {
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2966   err = -ENOMEM;
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2967   goto err;
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2968   }
a369d4ac4dff92 Maor Gottlieb 2017-08-27  2969  
ffdb8827ec31f6 Erez Shitrit  2017-04-13  2970   if 
MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_ETH) &&
ffdb8827ec31f6 Erez Shitrit  2017-04-13  2971 
(MLX5_CAP_GEN(dev, nic_flow_table))) ||
ffdb8827ec31f6 Erez Shitrit  2017-04-13  2972
((MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_IB) &&
ffdb8827ec31f6 Erez Shitrit  2017-04-13  2973 MLX5_CAP_GEN(dev, 
ipoib_enhanced_offloads))) &&
876d634d19e416 Maor Gottlieb 2016-06-10  2974   
MLX5_CAP_FLOWTABLE_NIC_RX(dev, ft_support)) {
fba53f7b571925 Maor Gottlieb 2016-07-04  2975   err = 
init_root_ns(steering);
2530236303d9e7 Maor Gottlieb 2015-12-10  2976   if (err)
43a335e055bb7e Amir Vadai2016-05-13  2977   goto 
err;
2530236303d9e7 Maor Gottlieb 2015-12-10  2978   }
876d634d19e416 Maor Gottlieb 2016-06-10  2979  
0efc8562491b7d Or Gerlitz2018-05-31  2980   if 
(MLX5_ESWITCH_MANAGER(dev)) {
bd02ef8eec0b98 Maor Gottlieb 2016-06-10  2981   if 
(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, ft_support)) {
fba53f7b571925 Maor Gottlieb 2016-07-04  2982   err = 
init_fdb_root_ns(steering);
2530236303d9e7 Maor Gottlieb 2015-12-10  2983   if (err)
efdc810ba39dae Mohamad Haj Yahia 2016-05-03  2984   
goto err;
efdc810ba39dae Mohamad Haj Yahia 2016-05-03  2985   }
bd02ef8eec0b98 Maor Gottlieb 2016-06-10  2986   }
2530236303d9e7 Maor Gottlieb 2015-12-10  2987  
87d22483ce68e6 Maor Gottlieb 2016-06-06  2988   if 
(MLX5_CAP_FLOWTABLE_SNIFFER_

[kbuild] Re: [PATCH for-next v4 10/10] RDMA/rxe: Disallow MR dereg and invalidate when bound

2021-04-22 Thread Dan Carpenter
Hi Bob,

url:
https://github.com/0day-ci/linux/commits/Bob-Pearson/RDMA-rxe-Implement-memory-windows/20210422-132958
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git  for-next
config: x86_64-randconfig-m001-20210421 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/infiniband/sw/rxe/rxe_mr.c:553 rxe_invalidate_mr() warn: ignoring 
unreachable code.

vim +553 drivers/infiniband/sw/rxe/rxe_mr.c

5f1e7f44d3a9cdb Bob Pearson 2021-04-22  529  int rxe_invalidate_mr(struct 
rxe_qp *qp, u32 rkey)
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  530  {
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  531 struct rxe_dev *rxe = 
to_rdev(qp->ibqp.device);
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  532 struct rxe_mr *mr;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  533 int ret;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  534  
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  535 mr = 
rxe_pool_get_index(>mr_pool, rkey >> 8);
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  536 if (!mr) {
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  537 pr_err("%s: No MR for 
rkey %#x\n", __func__, rkey);
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  538 ret = -EINVAL;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  539 goto err;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  540 }
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  541  
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  542 if (rkey != mr->ibmr.rkey) {
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  543 pr_err("%s: rkey (%#x) 
doesn't match mr->ibmr.rkey (%#x)\n",
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  544 __func__, rkey, 
mr->ibmr.rkey);
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  545 ret = -EINVAL;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  546 goto err_drop_ref;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  547 }
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  548  
740526f943e87ee Bob Pearson 2021-04-22  549 if (atomic_read(>num_mw) > 
0) {
740526f943e87ee Bob Pearson 2021-04-22  550 pr_warn("%s: Attempt to 
invalidate an MR while bound to MWs\n",
740526f943e87ee Bob Pearson 2021-04-22  551 
__func__);
740526f943e87ee Bob Pearson 2021-04-22  552 return -EINVAL;
740526f943e87ee Bob Pearson 2021-04-22 @553 goto err_drop_ref;

Either the goto or the return should be deleted.  I would have expected
that it would be the return to be deleted, otherwise it needs a big
comment why we're holding on to the reference.

740526f943e87ee Bob Pearson 2021-04-22  554 }
740526f943e87ee Bob Pearson 2021-04-22  555  
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  556 mr->state = RXE_MR_STATE_FREE;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  557 ret = 0;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  558  
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  559  err_drop_ref:
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  560 rxe_drop_ref(mr);
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  561  err:
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  562 return ret;
5f1e7f44d3a9cdb Bob Pearson 2021-04-22  563  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org 


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] [xlnx:release-2020.2.2_k26 207/241] drivers/pinctrl/core.c:1273 pinctrl_commit_state() error: uninitialized symbol 'ret'.

2021-04-20 Thread Dan Carpenter
tree:   https://github.com/Xilinx/linux-xlnx  release-2020.2.2_k26
head:   4731ff5042ce76fc145bc2797faa2d91b090675e
commit: 11367d8e6e31164b198401335b9a19b5b7234ec0 [207/241] pinctrl: core: 
Handling pinmux and pinconf separately
config: i386-randconfig-m021-20210419 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/pinctrl/core.c:1273 pinctrl_commit_state() error: uninitialized symbol 
'ret'.

vim +/ret +1273 drivers/pinctrl/core.c

981ed1bfbc6c46 Florian Fainelli  2017-03-01  1237  static int 
pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
befe5bdfbb698b Linus Walleij 2012-02-09  1238  {
6e5e959dde0d92 Stephen Warren2012-03-02  1239   struct pinctrl_setting 
*setting, *setting2;
50cf7c8ab324de Richard Genoud2013-03-25  1240   struct pinctrl_state 
*old_state = p->state;
6e5e959dde0d92 Stephen Warren2012-03-02  1241   int ret;
7ecdb16fe63e5b Stephen Warren2012-03-02  1242  
6e5e959dde0d92 Stephen Warren2012-03-02  1243   if (p->state) {
6e5e959dde0d92 Stephen Warren2012-03-02  1244   /*
2243a87d90b42e Fan Wu2014-06-09  1245* For each 
pinmux setting in the old state, forget SW's record
2243a87d90b42e Fan Wu2014-06-09  1246* of mux owner 
for that pingroup. Any pingroups which are
2243a87d90b42e Fan Wu2014-06-09  1247* still owned 
by the new state will be re-acquired by the call
2243a87d90b42e Fan Wu2014-06-09  1248* to 
pinmux_enable_setting() in the loop below.
6e5e959dde0d92 Stephen Warren2012-03-02  1249*/
6e5e959dde0d92 Stephen Warren2012-03-02  1250   
list_for_each_entry(setting, >state->settings, node) {
1e2082b5207217 Stephen Warren2012-03-02  1251   if 
(setting->type != PIN_MAP_TYPE_MUX_GROUP)
1e2082b5207217 Stephen Warren2012-03-02  1252   
continue;
7ecdb16fe63e5b Stephen Warren2012-03-02  1253   
pinmux_disable_setting(setting);
befe5bdfbb698b Linus Walleij 2012-02-09  1254   }
57b676f9c1b7cd Stephen Warren2012-03-02  1255   }
57b676f9c1b7cd Stephen Warren2012-03-02  1256  
3102a76cfbf9ac Richard Genoud2013-03-25  1257   p->state = NULL;
6e5e959dde0d92 Stephen Warren2012-03-02  1258  
11367d8e6e3116 Michal Simek  2021-03-10  1259   /* Apply all the 
settings for the new state - pinmux first */
6e5e959dde0d92 Stephen Warren2012-03-02  1260   
list_for_each_entry(setting, >settings, node) {
1e2082b5207217 Stephen Warren2012-03-02  1261   switch 
(setting->type) {
1e2082b5207217 Stephen Warren2012-03-02  1262   case 
PIN_MAP_TYPE_MUX_GROUP:
6e5e959dde0d92 Stephen Warren2012-03-02  1263   ret = 
pinmux_enable_setting(setting);
1e2082b5207217 Stephen Warren2012-03-02  1264   break;
1e2082b5207217 Stephen Warren2012-03-02  1265   case 
PIN_MAP_TYPE_CONFIGS_PIN:
11367d8e6e3116 Michal Simek  2021-03-10  1266   case 
PIN_MAP_TYPE_CONFIGS_GROUP:
11367d8e6e3116 Michal Simek  2021-03-10  1267   break;

"ret" not set for these cases.

11367d8e6e3116 Michal Simek  2021-03-10  1268   default:
11367d8e6e3116 Michal Simek  2021-03-10  1269   ret = 
-EINVAL;
11367d8e6e3116 Michal Simek  2021-03-10  1270   break;
11367d8e6e3116 Michal Simek  2021-03-10  1271   }
11367d8e6e3116 Michal Simek  2021-03-10  1272  
11367d8e6e3116 Michal Simek  2021-03-10 @1273   if (ret < 0)
11367d8e6e3116 Michal Simek  2021-03-10  1274   goto 
unapply_new_state;
11367d8e6e3116 Michal Simek  2021-03-10  1275  
11367d8e6e3116 Michal Simek  2021-03-10  1276   /* Do not link 
hogs (circular dependency) */
11367d8e6e3116 Michal Simek  2021-03-10  1277   if (p != 
setting->pctldev->p)
11367d8e6e3116 Michal Simek  2021-03-10  1278   
pinctrl_link_add(setting->pctldev, p->dev);
11367d8e6e3116 Michal Simek  2021-03-10  1279   }
11367d8e6e3116 Michal Simek  2021-03-10  1280  
11367d8e6e3116 Michal Simek  2021-03-10  1281   /* Apply all the 
settings for the new state - pinconf after */
11367d8e6e3116 Michal Simek  2021-03-10  1282   
list_for_each_entry(setting, >settings, node) {
11367d8e6e3116 Michal Simek  2021-03-10  1283   switch 
(setting->type) {
11367d8e6e3116 Michal Simek  2021-03-10  1284   case 
PIN_MAP_TYPE_MUX_GROUP:
11367d8e6e3116 Michal Simek  2021-03-10  1285  

[kbuild] [linux-next:master 12597/13745] drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c:222 dcn21_set_backlight_level() error: we previously assumed 'panel_cntl' could be null (see line

2021-04-20 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git  
master
head:   50b8b1d699ac313c0a07a3c185ffb23aecab8abb
commit: e922057b556d37c54f8f88e44f7d7b731d6365b1 [12597/13745] drm/amd/display: 
Added support for multiple eDP BL control
config: x86_64-randconfig-m001-20210419 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c:222 
dcn21_set_backlight_level() error: we previously assumed 'panel_cntl' could be 
null (see line 213)

vim +/panel_cntl +222 
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_hwseq.c

474ac4a875ca6f Yongqiang Sun 2020-04-27  198  bool 
dcn21_set_backlight_level(struct pipe_ctx *pipe_ctx,
474ac4a875ca6f Yongqiang Sun 2020-04-27  199uint32_t 
backlight_pwm_u16_16,
474ac4a875ca6f Yongqiang Sun 2020-04-27  200uint32_t frame_ramp)
474ac4a875ca6f Yongqiang Sun 2020-04-27  201  {
474ac4a875ca6f Yongqiang Sun 2020-04-27  202union dmub_rb_cmd cmd;
474ac4a875ca6f Yongqiang Sun 2020-04-27  203struct dc_context *dc = 
pipe_ctx->stream->ctx;
474ac4a875ca6f Yongqiang Sun 2020-04-27  204struct abm *abm = 
pipe_ctx->stream_res.abm;
474ac4a875ca6f Yongqiang Sun 2020-04-27  205uint32_t otg_inst = 
pipe_ctx->stream_res.tg->inst;
474ac4a875ca6f Yongqiang Sun 2020-04-27  206struct panel_cntl *panel_cntl = 
pipe_ctx->stream->link->panel_cntl;
474ac4a875ca6f Yongqiang Sun 2020-04-27  207  
474ac4a875ca6f Yongqiang Sun 2020-04-27  208if (dc->dc->res_pool->dmcu) {
474ac4a875ca6f Yongqiang Sun 2020-04-27  209
dce110_set_backlight_level(pipe_ctx, backlight_pwm_u16_16, frame_ramp);
474ac4a875ca6f Yongqiang Sun 2020-04-27  210return true;
474ac4a875ca6f Yongqiang Sun 2020-04-27  211}
474ac4a875ca6f Yongqiang Sun 2020-04-27  212  
474ac4a875ca6f Yongqiang Sun 2020-04-27 @213if (abm && panel_cntl)
   ^^
This code assumed "panel_cntl" can be NULL

474ac4a875ca6f Yongqiang Sun 2020-04-27  214dmub_abm_set_pipe(abm, 
otg_inst, SET_ABM_PIPE_NORMAL, panel_cntl->inst);
474ac4a875ca6f Yongqiang Sun 2020-04-27  215  
148816f93fa0db Wyatt Wood2021-01-18  216memset(, 0, sizeof(cmd));
474ac4a875ca6f Yongqiang Sun 2020-04-27  217
cmd.abm_set_backlight.header.type = DMUB_CMD__ABM;
474ac4a875ca6f Yongqiang Sun 2020-04-27  218
cmd.abm_set_backlight.header.sub_type = DMUB_CMD__ABM_SET_BACKLIGHT;
474ac4a875ca6f Yongqiang Sun 2020-04-27  219
cmd.abm_set_backlight.abm_set_backlight_data.frame_ramp = frame_ramp;
474ac4a875ca6f Yongqiang Sun 2020-04-27  220
cmd.abm_set_backlight.abm_set_backlight_data.backlight_user_level = 
backlight_pwm_u16_16;
e922057b556d37 Jake Wang 2021-04-01  221
cmd.abm_set_backlight.abm_set_backlight_data.version = 
DMUB_CMD_ABM_SET_BACKLIGHT_VERSION_1;
e922057b556d37 Jake Wang 2021-04-01 @222
cmd.abm_set_backlight.abm_set_backlight_data.panel_mask = (0x01 << 
panel_cntl->inst);

   
Unchecked dereference

474ac4a875ca6f Yongqiang Sun 2020-04-27  223
cmd.abm_set_backlight.header.payload_bytes = sizeof(struct 
dmub_cmd_abm_set_backlight_data);
474ac4a875ca6f Yongqiang Sun 2020-04-27  224  
474ac4a875ca6f Yongqiang Sun 2020-04-27  225
dc_dmub_srv_cmd_queue(dc->dmub_srv, );
474ac4a875ca6f Yongqiang Sun 2020-04-27  226
dc_dmub_srv_cmd_execute(dc->dmub_srv);
474ac4a875ca6f Yongqiang Sun 2020-04-27  227
dc_dmub_srv_wait_idle(dc->dmub_srv);
474ac4a875ca6f Yongqiang Sun 2020-04-27  228  
474ac4a875ca6f Yongqiang Sun 2020-04-27  229return true;
474ac4a875ca6f Yongqiang Sun 2020-04-27  230  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org 


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] [chrome-os:chromeos-5.4 56/243] drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_req_lat_if.c:751:10: warning: Expression is always false because 'else if' condition matches previous condition

2021-04-20 Thread Dan Carpenter
tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel  
chromeos-5.4
head:   52d269f32500581166246e0e494b2b62d979dba6
commit: bc0b0ae994e6bb17b12bfd882c2eb837eb29c078 [56/243] CHROMIUM: media: 
mtk-vcodec: Add vp9 slice api driver for mt8192
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_req_lat_if.c:751:10: 
>> warning: Expression is always false because 'else if' condition matches 
>> previous condition at line 749. [multiCondition]
else if (hdr->reset_frame_context == V4L2_VP9_RESET_FRAME_CTX_SPEC)
^

vim +751 drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_req_lat_if.c

bc0b0ae994e6bb Yunfei Dong 2021-01-21  730  static void 
vdec_vp9_slice_setup_hdr(
bc0b0ae994e6bb Yunfei Dong 2021-01-21  731  struct vdec_vp9_slice_instance 
*instance,
bc0b0ae994e6bb Yunfei Dong 2021-01-21  732  struct 
vdec_vp9_slice_uncompressed_header *uh,
bc0b0ae994e6bb Yunfei Dong 2021-01-21  733  struct 
v4l2_ctrl_vp9_frame_decode_params *hdr)
bc0b0ae994e6bb Yunfei Dong 2021-01-21  734  {
bc0b0ae994e6bb Yunfei Dong 2021-01-21  735  int i;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  736  
bc0b0ae994e6bb Yunfei Dong 2021-01-21  737  uh->profile = hdr->profile;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  738  uh->last_frame_type = 
instance->frame_type;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  739  uh->frame_type = 
!HDR_FLAG(KEY_FRAME);
bc0b0ae994e6bb Yunfei Dong 2021-01-21  740  uh->last_show_frame = 
instance->show_frame;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  741  uh->show_frame = 
HDR_FLAG(SHOW_FRAME);
bc0b0ae994e6bb Yunfei Dong 2021-01-21  742  uh->error_resilient_mode = 
HDR_FLAG(ERROR_RESILIENT);
bc0b0ae994e6bb Yunfei Dong 2021-01-21  743  uh->bit_depth = hdr->bit_depth;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  744  uh->last_frame_width = 
instance->width;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  745  uh->last_frame_height = 
instance->height;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  746  uh->frame_width = 
hdr->frame_width_minus_1 + 1;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  747  uh->frame_height = 
hdr->frame_height_minus_1 + 1;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  748  uh->intra_only = 
HDR_FLAG(INTRA_ONLY);
bc0b0ae994e6bb Yunfei Dong 2021-01-21 @749  if (hdr->reset_frame_context == 
V4L2_VP9_RESET_FRAME_CTX_SPEC)

^

bc0b0ae994e6bb Yunfei Dong 2021-01-21  750  uh->reset_frame_context 
= 2;
bc0b0ae994e6bb Yunfei Dong 2021-01-21 @751  else if 
(hdr->reset_frame_context == V4L2_VP9_RESET_FRAME_CTX_SPEC)
 
^
Same same.

bc0b0ae994e6bb Yunfei Dong 2021-01-21  752  uh->reset_frame_context 
= 3;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  753  else
bc0b0ae994e6bb Yunfei Dong 2021-01-21  754  uh->reset_frame_context 
= 0;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  755  /*
bc0b0ae994e6bb Yunfei Dong 2021-01-21  756   * ref_frame_sign_bias 
specifies the intended direction
bc0b0ae994e6bb Yunfei Dong 2021-01-21  757   * of the motion vector in time 
for each reference frame.
bc0b0ae994e6bb Yunfei Dong 2021-01-21  758   * - INTRA_FRAME = 0,
bc0b0ae994e6bb Yunfei Dong 2021-01-21  759   * - LAST_FRAME = 1,
bc0b0ae994e6bb Yunfei Dong 2021-01-21  760   * - GOLDEN_FRAME = 2,
bc0b0ae994e6bb Yunfei Dong 2021-01-21  761   * - ALTREF_FRAME = 3,
bc0b0ae994e6bb Yunfei Dong 2021-01-21  762   * 
ref_frame_sign_biases[INTRA_FRAME] is always 0
bc0b0ae994e6bb Yunfei Dong 2021-01-21  763   * and VDA only passes another 
3 directions
bc0b0ae994e6bb Yunfei Dong 2021-01-21  764   */
bc0b0ae994e6bb Yunfei Dong 2021-01-21  765  uh->ref_frame_sign_bias[0] = 0;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  766  for (i = 0; i < 3; i++)
bc0b0ae994e6bb Yunfei Dong 2021-01-21  767  
uh->ref_frame_sign_bias[i + 1] =
bc0b0ae994e6bb Yunfei Dong 2021-01-21  768  
!!(hdr->ref_frame_sign_biases & (1 << i));
bc0b0ae994e6bb Yunfei Dong 2021-01-21  769  uh->allow_high_precision_mv = 
HDR_FLAG(ALLOW_HIGH_PREC_MV);
bc0b0ae994e6bb Yunfei Dong 2021-01-21  770  uh->interpolation_filter = 
hdr->interpolation_filter;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  771  uh->refresh_frame_context = 
HDR_FLAG(REFRESH_FRAME_CTX);
bc0b0ae994e6bb Yunfei Dong 2021-01-21  772  
uh->frame_parallel_decoding_mode = HDR_FLAG(PARALLEL_DEC_MODE);
bc0b0ae994e6bb Yunfei Dong 2021-01-21  773  uh->frame_context_idx = 
hdr->frame_context_idx;
bc0b0ae994e6bb Yunfei Dong 2021-01-21  774  
bc0b0ae994e6bb Yunfei Dong 2021-01-21  775  /* tile info */
bc0b0ae994e6bb 

[kbuild] [freescale-fslc:pr/312 15428/18196] sound/soc/codecs/pcm512x.c:1658 pcm512x_probe() warn: missing error code 'ret'

2021-04-20 Thread Dan Carpenter
tree:   https://github.com/Freescale/linux-fslc  pr/312
head:   98ba4471da6187346dbcc17cdf31671fb5d28b91
commit: a452c44357d9c68c27c39327e50b41e4b6cffe8d [15428/18196] MLK-25015: 
sound: soc: codecs: pcm512x: set input sclk
config: x86_64-randconfig-m001-20210416 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
sound/soc/codecs/pcm512x.c:1658 pcm512x_probe() warn: missing error code 'ret'

vim +/ret +1658 sound/soc/codecs/pcm512x.c

22066226b50e40 Mark Brown2014-03-07  1555  int pcm512x_probe(struct 
device *dev, struct regmap *regmap)
5a3af1293194d0 Mark Brown2014-02-06  1556  {
5a3af1293194d0 Mark Brown2014-02-06  1557   struct pcm512x_priv 
*pcm512x;
a452c44357d9c6 Adrian Alonso 2020-11-16  1558   char clk_name[8];
5a3af1293194d0 Mark Brown2014-02-06  1559   int i, ret;
5a3af1293194d0 Mark Brown2014-02-06  1560  
5a3af1293194d0 Mark Brown2014-02-06  1561   pcm512x = 
devm_kzalloc(dev, sizeof(struct pcm512x_priv), GFP_KERNEL);
5a3af1293194d0 Mark Brown2014-02-06  1562   if (!pcm512x)
5a3af1293194d0 Mark Brown2014-02-06  1563   return -ENOMEM;
5a3af1293194d0 Mark Brown2014-02-06  1564  
3500f1c589e92e Dimitris Papavasiliou 2018-11-24  1565   
mutex_init(>mutex);
3500f1c589e92e Dimitris Papavasiliou 2018-11-24  1566  
5a3af1293194d0 Mark Brown2014-02-06  1567   dev_set_drvdata(dev, 
pcm512x);
5a3af1293194d0 Mark Brown2014-02-06  1568   pcm512x->regmap = 
regmap;
5a3af1293194d0 Mark Brown2014-02-06  1569  
5a3af1293194d0 Mark Brown2014-02-06  1570   for (i = 0; i < 
ARRAY_SIZE(pcm512x->supplies); i++)
5a3af1293194d0 Mark Brown2014-02-06  1571   
pcm512x->supplies[i].supply = pcm512x_supply_names[i];
5a3af1293194d0 Mark Brown2014-02-06  1572  
5a3af1293194d0 Mark Brown2014-02-06  1573   ret = 
devm_regulator_bulk_get(dev, ARRAY_SIZE(pcm512x->supplies),
5a3af1293194d0 Mark Brown2014-02-06  1574   
  pcm512x->supplies);
5a3af1293194d0 Mark Brown2014-02-06  1575   if (ret != 0) {
5a3af1293194d0 Mark Brown2014-02-06  1576   dev_err(dev, 
"Failed to get supplies: %d\n", ret);
5a3af1293194d0 Mark Brown2014-02-06  1577   return ret;
5a3af1293194d0 Mark Brown2014-02-06  1578   }
5a3af1293194d0 Mark Brown2014-02-06  1579  
5a3af1293194d0 Mark Brown2014-02-06  1580   
pcm512x->supply_nb[0].notifier_call = pcm512x_regulator_event_0;
5a3af1293194d0 Mark Brown2014-02-06  1581   
pcm512x->supply_nb[1].notifier_call = pcm512x_regulator_event_1;
5a3af1293194d0 Mark Brown2014-02-06  1582   
pcm512x->supply_nb[2].notifier_call = pcm512x_regulator_event_2;
5a3af1293194d0 Mark Brown2014-02-06  1583  
5a3af1293194d0 Mark Brown2014-02-06  1584   for (i = 0; i < 
ARRAY_SIZE(pcm512x->supplies); i++) {
0bb423f2eaafed Guennadi Liakhovetski 2019-02-08  1585   ret = 
devm_regulator_register_notifier(
0bb423f2eaafed Guennadi Liakhovetski 2019-02-08  1586   
pcm512x->supplies[i].consumer,
5a3af1293194d0 Mark Brown2014-02-06  1587   
>supply_nb[i]);
5a3af1293194d0 Mark Brown2014-02-06  1588   if (ret != 0) {
5a3af1293194d0 Mark Brown2014-02-06  1589   
dev_err(dev,
5a3af1293194d0 Mark Brown2014-02-06  1590   
"Failed to register regulator notifier: %d\n",
5a3af1293194d0 Mark Brown2014-02-06  1591   
ret);
5a3af1293194d0 Mark Brown2014-02-06  1592   }
5a3af1293194d0 Mark Brown2014-02-06  1593   }
5a3af1293194d0 Mark Brown2014-02-06  1594  
5a3af1293194d0 Mark Brown2014-02-06  1595   ret = 
regulator_bulk_enable(ARRAY_SIZE(pcm512x->supplies),
5a3af1293194d0 Mark Brown2014-02-06  1596   
pcm512x->supplies);
5a3af1293194d0 Mark Brown2014-02-06  1597   if (ret != 0) {
5a3af1293194d0 Mark Brown2014-02-06  1598   dev_err(dev, 
"Failed to enable supplies: %d\n", ret);
5a3af1293194d0 Mark Brown2014-02-06  1599   return ret;
5a3af1293194d0 Mark Brown2014-02-06  1600   }
5a3af1293194d0 Mark Brown2014-02-06  1601  
5a3af1293194d0 Mark Brown2014-02-06  1602   /* Reset the device, 
verifying I/O in the process for I2C */
5a3af1293194d0 Mark Brown2014-02-06  1603   ret = 
regmap_write(regmap, PCM512x_RESET,
5a3af1293194d0 Mark Brown

[kbuild] [chrome-os:chromeos-5.4 54/243] drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_lat_if.c:575:34: warning: Uninitialized variable: timeout [uninitvar]

2021-04-20 Thread Dan Carpenter
tree:   https://chromium.googlesource.com/chromiumos/third_party/kernel  
chromeos-5.4
head:   52d269f32500581166246e0e494b2b62d979dba6
commit: 0a438b290ea431bc87156be5819e9f85fa951240 [54/243] CHROMIUM: media: 
mtk-vcodec: Add h264 slice api driver for mt8192
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_lat_if.c:575:34: 
>> warning: Uninitialized variable: timeout [uninitvar]
if (err == SLICE_HEADER_FULL || timeout || (err == TRANS_BUFFER_FULL &&
^

vim +575 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_lat_if.c

0a438b290ea431 Yunfei Dong 2021-01-05  473  static int 
vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
0a438b290ea431 Yunfei Dong 2021-01-05  474  struct vdec_fb *fb, bool 
*res_chg)
0a438b290ea431 Yunfei Dong 2021-01-05  475  {
0a438b290ea431 Yunfei Dong 2021-01-05  476  struct vdec_h264_slice_inst 
*inst = h_vdec;
0a438b290ea431 Yunfei Dong 2021-01-05  477  struct vdec_vpu_inst *vpu = 
>vpu;
0a438b290ea431 Yunfei Dong 2021-01-05  478  struct mtk_video_dec_buf 
*src_buf_info;
0a438b290ea431 Yunfei Dong 2021-01-05  479  int nal_start_idx, err, 
timeout, i;
^^^

0a438b290ea431 Yunfei Dong 2021-01-05  480  unsigned int nal_type, data[2];
0a438b290ea431 Yunfei Dong 2021-01-05  481  struct vdec_lat_buf *lat_buf;
0a438b290ea431 Yunfei Dong 2021-01-05  482  struct 
vdec_h264_slice_share_info *share_info;
0a438b290ea431 Yunfei Dong 2021-01-05  483  unsigned char *buf;
0a438b290ea431 Yunfei Dong 2021-01-05  484  struct mtk_vcodec_mem *mem;
0a438b290ea431 Yunfei Dong 2021-01-05  485  
0a438b290ea431 Yunfei Dong 2021-01-05  486  mtk_vcodec_debug(inst, "+ [%d] 
", ++inst->num_nalu);
0a438b290ea431 Yunfei Dong 2021-01-05  487  
0a438b290ea431 Yunfei Dong 2021-01-05  488  if 
(!inst->ctx->msg_queue.init_done) {
0a438b290ea431 Yunfei Dong 2021-01-05  489  if 
(vdec_msg_queue_init(inst->ctx, >ctx->msg_queue,
0a438b290ea431 Yunfei Dong 2021-01-05  490  
vdec_h264_slice_core_decode, sizeof(*share_info)))
0a438b290ea431 Yunfei Dong 2021-01-05  491  return -ENOMEM;
0a438b290ea431 Yunfei Dong 2021-01-05  492  }
0a438b290ea431 Yunfei Dong 2021-01-05  493  
0a438b290ea431 Yunfei Dong 2021-01-05  494  /* bs NULL means flush decoder 
*/
0a438b290ea431 Yunfei Dong 2021-01-05  495  if (!bs) {
0a438b290ea431 Yunfei Dong 2021-01-05  496  
vdec_msg_queue_wait_lat_buf_full(>ctx->msg_queue);
0a438b290ea431 Yunfei Dong 2021-01-05  497  return 
vpu_dec_reset(vpu);
0a438b290ea431 Yunfei Dong 2021-01-05  498  }
0a438b290ea431 Yunfei Dong 2021-01-05  499  
0a438b290ea431 Yunfei Dong 2021-01-05  500  lat_buf = 
vdec_msg_queue_get_lat_buf(>ctx->msg_queue);
0a438b290ea431 Yunfei Dong 2021-01-05  501  if (!lat_buf) {
0a438b290ea431 Yunfei Dong 2021-01-05  502  mtk_vcodec_err(inst, 
"failed to get lat buffer");
0a438b290ea431 Yunfei Dong 2021-01-05  503  return -EINVAL;
0a438b290ea431 Yunfei Dong 2021-01-05  504  }
0a438b290ea431 Yunfei Dong 2021-01-05  505  share_info = 
lat_buf->private_data;
0a438b290ea431 Yunfei Dong 2021-01-05  506  src_buf_info = container_of(bs, 
struct mtk_video_dec_buf, bs_buffer);
0a438b290ea431 Yunfei Dong 2021-01-05  507  
0a438b290ea431 Yunfei Dong 2021-01-05  508  buf = (unsigned char *)bs->va;
0a438b290ea431 Yunfei Dong 2021-01-05  509  nal_start_idx = 
mtk_vdec_h264_find_start_code(buf, bs->size);
0a438b290ea431 Yunfei Dong 2021-01-05  510  if (nal_start_idx < 0) {
0a438b290ea431 Yunfei Dong 2021-01-05  511  err = -EINVAL;
0a438b290ea431 Yunfei Dong 2021-01-05  512  goto err_free_fb_out;
0a438b290ea431 Yunfei Dong 2021-01-05  513  }
0a438b290ea431 Yunfei Dong 2021-01-05  514  
0a438b290ea431 Yunfei Dong 2021-01-05  515  inst->vsi->dec.nal_info = 
buf[nal_start_idx];
0a438b290ea431 Yunfei Dong 2021-01-05  516  nal_type = 
NAL_TYPE(buf[nal_start_idx]);
0a438b290ea431 Yunfei Dong 2021-01-05  517  mtk_vcodec_debug(inst, "\n + 
NALU[%d] type %d +\n", inst->num_nalu,
0a438b290ea431 Yunfei Dong 2021-01-05  518   nal_type);
0a438b290ea431 Yunfei Dong 2021-01-05  519  
0a438b290ea431 Yunfei Dong 2021-01-05  520  inst->vsi->dec.bs_buf_addr = 
(uint64_t)bs->dma_addr;
0a438b290ea431 Yunfei Dong 2021-01-05  521  inst->vsi->dec.bs_buf_size = 
bs->size;
0a438b290ea431 Yunfei Dong 2021-01-05  522  
0a438b290ea431 Yunfei Dong 2021-01-05  523  
v4l2_m2m_buf_copy_metadata(_buf_info->m2m_buf.vb,
0a438b290ea431 Yunfei Dong 2021-01-05  524  _buf->ts_info, 
true);
0a438b290ea431 Yunfei Dong 2021-01-05  

[kbuild] [block:for-5.13/drivers 46/61] drivers/md/bcache/nvm-pages.c:156:34: warning: Unsigned variable 'i' can't be negative so it is unnecessary to test it. [unsignedPositive]

2021-04-20 Thread Dan Carpenter
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git  
for-5.13/drivers
head:   b09729cbbbf28ecdc61f00335684f7566eb740ec
commit: 97c62b647fcabd86fe703f9869be7dd91e685f50 [46/61] bcache: initialization 
of the buddy
compiler: microblaze-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/md/bcache/nvm-pages.c:156:34: warning: Unsigned variable 'i' can't 
>> be negative so it is unnecessary to test it. [unsignedPositive]
  for (i = BCH_MAX_ORDER - 1; i >= 0 ; i--) {
^

vim +156 drivers/md/bcache/nvm-pages.c

97c62b647fcabd Jianpeng Ma 2021-04-14  144  static void 
init_nvm_free_space(struct bch_nvm_namespace *ns)
97c62b647fcabd Jianpeng Ma 2021-04-14  145  {
97c62b647fcabd Jianpeng Ma 2021-04-14  146  unsigned int start, end, i;
 ^

97c62b647fcabd Jianpeng Ma 2021-04-14  147  struct page *page;
97c62b647fcabd Jianpeng Ma 2021-04-14  148  long long pages;
97c62b647fcabd Jianpeng Ma 2021-04-14  149  pgoff_t pgoff_start;
97c62b647fcabd Jianpeng Ma 2021-04-14  150  
97c62b647fcabd Jianpeng Ma 2021-04-14  151  
bitmap_for_each_clear_region(ns->pages_bitmap, start, end, 0, ns->pages_total) {
97c62b647fcabd Jianpeng Ma 2021-04-14  152  pgoff_start = start;
97c62b647fcabd Jianpeng Ma 2021-04-14  153  pages = end - start;
97c62b647fcabd Jianpeng Ma 2021-04-14  154  
97c62b647fcabd Jianpeng Ma 2021-04-14  155  while (pages) {
97c62b647fcabd Jianpeng Ma 2021-04-14 @156  for (i = 
BCH_MAX_ORDER - 1; i >= 0 ; i--) {

^^
This needs to be "int i;" for the loop to work correctly.

97c62b647fcabd Jianpeng Ma 2021-04-14  157  if 
((pgoff_start % (1 << i) == 0) && (pages >= (1 << i)))
97c62b647fcabd Jianpeng Ma 2021-04-14  158  
break;
97c62b647fcabd Jianpeng Ma 2021-04-14  159  }
97c62b647fcabd Jianpeng Ma 2021-04-14  160  
97c62b647fcabd Jianpeng Ma 2021-04-14  161  page = 
nvm_vaddr_to_page(ns, nvm_pgoff_to_vaddr(ns, pgoff_start));
97c62b647fcabd Jianpeng Ma 2021-04-14  162  page->index = 
pgoff_start;
97c62b647fcabd Jianpeng Ma 2021-04-14  163  
set_page_private(page, i);
97c62b647fcabd Jianpeng Ma 2021-04-14  164  
__SetPageBuddy(page);
97c62b647fcabd Jianpeng Ma 2021-04-14  165  
list_add((struct list_head *)>zone_device_data, >free_area[i]);
97c62b647fcabd Jianpeng Ma 2021-04-14  166  
97c62b647fcabd Jianpeng Ma 2021-04-14  167  pgoff_start += 
1 << i;
97c62b647fcabd Jianpeng Ma 2021-04-14  168  pages -= 1 << i;
97c62b647fcabd Jianpeng Ma 2021-04-14  169  }
97c62b647fcabd Jianpeng Ma 2021-04-14  170  }
688330711e9ae3 Jianpeng Ma 2021-04-14  171  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org 
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: drivers/gpu/drm/msm/adreno/a3xx_gpu.c:600 a3xx_gpu_init() error: passing non negative 1 to ERR_PTR

2021-04-15 Thread Dan Carpenter
On Thu, Apr 15, 2021 at 04:21:01PM -0700, Rob Clark wrote:
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  571 icc_path = 
> > > devm_of_icc_get(>dev, "gfx-mem");
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  572 ret = 
> > > IS_ERR(icc_path);
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  573 if (ret)
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  574 goto fail;
> > >
> > > IS_ERR() returns/true false so this will lead to an Oops in the caller.
> > >
> > >   icc_path = devm_of_icc_get(>dev, "gfx-mem");
> > >   if (IS_ERR(icc_path)) {
> > >   ret = PTR_ERR(icc_path);
> > >   goto fail;
> > >   }
> > Agree.
> >
> > >
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  575
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  576 ocmem_icc_path = 
> > > devm_of_icc_get(>dev, "ocmem");
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  577 ret = 
> > > IS_ERR(ocmem_icc_path);
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  578 if (ret) {
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  579 /* allow 
> > > -ENODATA, ocmem icc is optional */
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  580 if (ret != 
> > > -ENODATA)
> > > 5785dd7a8ef0de Akhil P Oommen 2020-10-28  581 
> > > goto fail;
> > >
> > > Same.  ret is true/false so it can't be equal to -ENODATA, plus the
> > > caller will Oops.
> > >
> > > Btw, this patch removed the assignments:
> > >
> > >   gpu->icc_path = of_icc_get(dev, "gfx-mem");
> > >   gpu->ocmem_icc_path = of_icc_get(dev, "ocmem");
> > >
> > > So I think "gpu->icc_path" and "gpu->ocmem_icc_path" are always
> > > NULL/unused and they should be removed.
> > >
> > Agree. Will share a fix.
> > Thanks, Dan.
> 
> gpu->ocmem_icc_path/icc_path is used on older devices.. it sounds like
> we broke some older devices and no one has noticed yet?

This is error paths and dead code.  Probably no one is affected in
real life.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH v18 1/2] scsi: ufs: Enable power management for wlun

2021-04-15 Thread Dan Carpenter
Hi Asutosh,

url:
https://github.com/0day-ci/linux/commits/Asutosh-Das/Enable-power-management-for-ufs-wlun/20210415-030146
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-m021-20210415 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/scsi/ufs/ufshcd.c:9017 ufshcd_wl_resume() error: potentially 
dereferencing uninitialized 'hba'.
drivers/scsi/ufs/ufshcd.c:9141 ufshcd_system_suspend() error: uninitialized 
symbol 'ret'.
drivers/scsi/ufs/ufshcd.c:9166 ufshcd_system_resume() error: uninitialized 
symbol 'ret'.

Old smatch warnings:
drivers/scsi/ufs/ufshcd.c:5112 ufshcd_uic_cmd_compl() error: we previously 
assumed 'hba->active_uic_cmd' could be null (see line 5100)

vim +/hba +9017 drivers/scsi/ufs/ufshcd.c

9bad6c1c707d2a Asutosh Das2021-04-14  8998  
9bad6c1c707d2a Asutosh Das2021-04-14  8999  static int 
ufshcd_wl_resume(struct device *dev)
9bad6c1c707d2a Asutosh Das2021-04-14  9000  {
9bad6c1c707d2a Asutosh Das2021-04-14  9001  struct scsi_device 
*sdev = to_scsi_device(dev);
9bad6c1c707d2a Asutosh Das2021-04-14  9002  struct ufs_hba *hba;
^^^

9bad6c1c707d2a Asutosh Das2021-04-14  9003  int ret = 0;
9bad6c1c707d2a Asutosh Das2021-04-14  9004  ktime_t start = 
ktime_get();
9bad6c1c707d2a Asutosh Das2021-04-14  9005  
9bad6c1c707d2a Asutosh Das2021-04-14  9006  if 
(pm_runtime_suspended(dev))
9bad6c1c707d2a Asutosh Das2021-04-14  9007  goto out;


9bad6c1c707d2a Asutosh Das2021-04-14  9008  
9bad6c1c707d2a Asutosh Das2021-04-14  9009  hba = 
shost_priv(sdev->host);
9bad6c1c707d2a Asutosh Das2021-04-14  9010  
9bad6c1c707d2a Asutosh Das2021-04-14  9011  ret = 
__ufshcd_wl_resume(hba, UFS_SYSTEM_PM);
9bad6c1c707d2a Asutosh Das2021-04-14  9012  if (ret)
9bad6c1c707d2a Asutosh Das2021-04-14  9013  
dev_err(>sdev_gendev, "%s failed: %d\n", __func__, ret);
9bad6c1c707d2a Asutosh Das2021-04-14  9014  out:
9bad6c1c707d2a Asutosh Das2021-04-14  9015  
trace_ufshcd_wl_resume(dev_name(dev), ret,
9bad6c1c707d2a Asutosh Das2021-04-14  9016  
ktime_to_us(ktime_sub(ktime_get(), start)),
9bad6c1c707d2a Asutosh Das2021-04-14 @9017  
hba->curr_dev_pwr_mode, hba->uic_link_state);

^^
Uninitialized.

9bad6c1c707d2a Asutosh Das2021-04-14  9018  if (!ret)
9bad6c1c707d2a Asutosh Das2021-04-14  9019  
hba->is_sys_suspended = false;
9bad6c1c707d2a Asutosh Das2021-04-14  9020  up(>host_sem);
9bad6c1c707d2a Asutosh Das2021-04-14  9021  return ret;
9bad6c1c707d2a Asutosh Das2021-04-14  9022  }

  [ snip ]

57d104c153d3d6 Subhash Jadavani   2014-09-25  9131  int 
ufshcd_system_suspend(struct ufs_hba *hba)
7a3e97b0dc4bba Santosh Yaraganavi 2012-02-29  9132  {
9bad6c1c707d2a Asutosh Das2021-04-14  9133  int ret;
7ff5ab47363334 Subhash Jadavani   2016-12-22  9134  ktime_t start = 
ktime_get();
57d104c153d3d6 Subhash Jadavani   2014-09-25  9135  
9bad6c1c707d2a Asutosh Das2021-04-14  9136  if 
(pm_runtime_suspended(hba->dev))
57d104c153d3d6 Subhash Jadavani   2014-09-25  9137  goto out;


3b1d05807a9a68 Vinayak Holikatti  2013-02-25  9138  
9bad6c1c707d2a Asutosh Das2021-04-14  9139  ret = 
ufshcd_suspend(hba);
57d104c153d3d6 Subhash Jadavani   2014-09-25  9140  out:
7ff5ab47363334 Subhash Jadavani   2016-12-22 @9141  
trace_ufshcd_system_suspend(dev_name(hba->dev), ret,

^^^
"ret" uninitialized.

7ff5ab47363334 Subhash Jadavani   2016-12-22  9142  
ktime_to_us(ktime_sub(ktime_get(), start)),
73eba2be9203c0 Subhash Jadavani   2017-01-10  9143  
hba->curr_dev_pwr_mode, hba->uic_link_state);
57d104c153d3d6 Subhash Jadavani   2014-09-25  9144  return ret;
57d104c153d3d6 Subhash Jadavani   2014-09-25  9145  }
57d104c153d3d6 Subhash Jadavani   2014-09-25  9146  
EXPORT_SYMBOL(ufshcd_system_suspend);
57d104c153d3d6 Subhash Jadavani   2014-09-25  9147  
57d104c153d3d6 Subhash Jadavani   2014-09-25  9148  /**
57d104c153d3d6 Subhash Jadavani   2014-09-25  9149   * ufshcd_system_resume - 
system resume routine
57d104c153d3d6 Subhash Jadava

[kbuild] Re: [PATCH 13/15] usb: dwc2: Add exit hibernation mode before removing drive

2021-04-15 Thread Dan Carpenter
Hi Artur,

https://git-scm.com/docs/git-format-patch ]

url:
https://github.com/0day-ci/linux/commits/Artur-Petrosyan/usb-dwc2-Update-exit-hibernation-when-port-reset-is-asserted/20210415-144021
 
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git  
usb-testing
config: i386-randconfig-m021-20210415 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/usb/dwc2/platform.c:324 dwc2_driver_remove() error: potentially 
dereferencing uninitialized 'gr'.

vim +/gr +324 drivers/usb/dwc2/platform.c

5b9974b13e3648 drivers/staging/dwc2/platform.c Matthijs Kooijman  2013-04-22  
316  static int dwc2_driver_remove(struct platform_device *dev)
5b9974b13e3648 drivers/staging/dwc2/platform.c Matthijs Kooijman  2013-04-22  
317  {
5b9974b13e3648 drivers/staging/dwc2/platform.c Matthijs Kooijman  2013-04-22  
318   struct dwc2_hsotg *hsotg = platform_get_drvdata(dev);
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
319   struct dwc2_gregs_backup *gr;

  ^^
b46b1ef7b0da5c drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-08  
320   int ret = 0;
b46b1ef7b0da5c drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-08  
321  
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
322   /* Exit Hibernation when driver is removed. */
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
323   if (hsotg->hibernated) {
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15 
@324   if (gr->gotgctl & GOTGCTL_CURMODE_HOST) {

^^^
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
325   ret = dwc2_exit_hibernation(hsotg, 0, 0, 1);
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
326   if (ret)
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
327   dev_err(hsotg->dev,
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
328   "exit hibernation failed.\n");
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
329   } else {
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
330   ret = dwc2_exit_hibernation(hsotg, 0, 0, 0);
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
331   if (ret)
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
332   dev_err(hsotg->dev,
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
333   "exit hibernation failed.\n");
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
334   }
8e4dbc0200040a drivers/usb/dwc2/platform.c Artur Petrosyan2021-04-15  
335   }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org 


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH net-next v2 1/2] of: net: pass the dst buffer to of_get_mac_address()

2021-04-13 Thread Dan Carpenter
Hi Michael,

url:
https://github.com/0day-ci/linux/commits/Michael-Walle/of-net-support-non-platform-devices-in-of_get_mac_address/20210406-234030
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
cc0626c2aaed8e475efdd85fa374b497a7192e35
config: x86_64-randconfig-m001-20210406 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/net/ethernet/xilinx/xilinx_axienet_main.c:2069 axienet_probe() warn: 
passing a valid pointer to 'PTR_ERR'

vim +/PTR_ERR +2069 drivers/net/ethernet/xilinx/xilinx_axienet_main.c

522856cefaf09d Robert Hancock  2019-06-06  2060 /* Check for Ethernet 
core IRQ (optional) */
522856cefaf09d Robert Hancock  2019-06-06  2061 if (lp->eth_irq <= 0)
522856cefaf09d Robert Hancock  2019-06-06  2062 
dev_info(>dev, "Ethernet core IRQ not defined\n");
522856cefaf09d Robert Hancock  2019-06-06  2063  
8a3b7a252dca9f Daniel Borkmann 2012-01-19  2064 /* Retrieve the MAC 
address */
411b125c6ace1f Michael Walle   2021-04-06  2065 ret = 
of_get_mac_address(pdev->dev.of_node, mac_addr);
411b125c6ace1f Michael Walle   2021-04-06  2066 if (!ret) {
411b125c6ace1f Michael Walle   2021-04-06  2067 
axienet_set_mac_address(ndev, mac_addr);
411b125c6ace1f Michael Walle   2021-04-06  2068 } else {
d05a9ed5c3a773 Robert Hancock  2019-06-06 @2069 
dev_warn(>dev, "could not find MAC address property: %ld\n",
d05a9ed5c3a773 Robert Hancock  2019-06-06  2070  
PTR_ERR(mac_addr));
 
^
This should print "ret".

411b125c6ace1f Michael Walle   2021-04-06  2071 
axienet_set_mac_address(ndev, NULL);
8a3b7a252dca9f Daniel Borkmann 2012-01-19  2072 }
8a3b7a252dca9f Daniel Borkmann 2012-01-19  2073  
8a3b7a252dca9f Daniel Borkmann 2012-01-19  2074 lp->coalesce_count_rx = 
XAXIDMA_DFT_RX_THRESHOLD;
8a3b7a252dca9f Daniel Borkmann 2012-01-19  2075 lp->coalesce_count_tx = 
XAXIDMA_DFT_TX_THRESHOLD;

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [mkp-scsi:for-next 304/324] drivers/scsi/smartpqi/smartpqi_sas_transport.c:97 pqi_sas_port_add_rphy() warn: variable dereferenced before check 'pqi_sas_port->device' (see line 95)

2021-04-13 Thread Dan Carpenter
On Tue, Apr 13, 2021 at 10:33:57PM -0400, Martin K. Petersen wrote:
> 
> Dan,
> 
> > smatch warnings:
> > drivers/scsi/smartpqi/smartpqi_sas_transport.c:97 pqi_sas_port_add_rphy() 
> > warn: variable dereferenced before check 'pqi_sas_port->device' (see line 
> > 95)
> 
> Microchip: This is the second time this issue has been reported.

Oops.  Sorry, that's my bad.  I didn't mean to report it twice.  I've
been catching up on email after a small vacation so my mind is a bit
scattered.

regards,
dan carpenter
___
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org


[kbuild] Re: [PATCH V4 2/2] net: ethernet: ravb: Enable optional refclk

2021-04-13 Thread Dan Carpenter
Hi Adam,

url:
https://github.com/0day-ci/linux/commits/Adam-Ford/dt-bindings-net-renesas-etheravb-Add-additional-clocks/20210412-212824
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 
6628ddfec7580882f11fdc5c194a8ea781fdadfa
config: m68k-randconfig-m031-20210412 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/net/ethernet/renesas/ravb_main.c:2254 ravb_probe() error: potentially 
dereferencing uninitialized 'priv'.

vim +/priv +2254 drivers/net/ethernet/renesas/ravb_main.c

c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2043  static int ravb_probe(struct platform_device *pdev)
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2044  {
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2045 struct device_node *np = pdev->dev.of_node;
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2046 struct ravb_private *priv;
22d4df8ff3a3cc drivers/net/ethernet/renesas/ravb_main.c Kazuya Mizuguchi   
2015-09-30  2047 enum ravb_chip_id chip_id;
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2048 struct net_device *ndev;
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2049 int error, irq, q;
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2050 struct resource *res;
f51bdc236b6c58 drivers/net/ethernet/renesas/ravb_main.c Kazuya Mizuguchi   
2016-04-03  2051 int i;
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2052  
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2053 if (!np) {
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2054 dev_err(>dev,
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2055 "this driver is required to be 
instantiated from device tree\n");
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2056 return -EINVAL;
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2057 }
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2058  
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2059 /* Get base address */
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2060 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2061 if (!res) {
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2062 dev_err(>dev, "invalid resource\n");
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2063 return -EINVAL;
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2064 }
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2065  
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2066 ndev = alloc_etherdev_mqs(sizeof(struct ravb_private),
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2067   NUM_TX_QUEUE, NUM_RX_QUEUE);
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2068 if (!ndev)
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2069 return -ENOMEM;
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2070  
4d86d381862714 drivers/net/ethernet/renesas/ravb_main.c Simon Horman   
2017-10-04  2071 ndev->features = NETIF_F_RXCSUM;
4d86d381862714 drivers/net/ethernet/renesas/ravb_main.c Simon Horman   
2017-10-04  2072 ndev->hw_features = NETIF_F_RXCSUM;
4d86d381862714 drivers/net/ethernet/renesas/ravb_main.c Simon Horman   
2017-10-04  2073  
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2074 pm_runtime_enable(>dev);
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2075 pm_runtime_get_sync(>dev);
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2076  
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Sergei Shtylyov
2015-06-11  2077 /* The Ether-specific entries in the device structure. */
c156633f135326 drivers/net/ethernet/renesas/ravb.c  Serg

  1   2   3   4   5   6   7   8   9   10   >