Re: [Ksummit-discuss] crediting bug reports and fixes folded into original patch
I'd like a "Fixes-from: Name email" tag for when someone spots a bug in a patch. I think we should not give credit for style complaints, because those are their own reward and we already have enough bike shedding. regards, dan carpenter
arch/s390/pci/pci_event.c:101 __zpci_event_availability() error: we previously assumed 'zdev->zbus' could be null (see line 83)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 3bb61aa61828499a7d0f5e560051625fd02ae7e4 commit: 3047766bc6ec9c6bc9ece85b45a41ff401e8d988 s390/pci: fix enabling a reserved PCI function If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter smatch warnings: arch/s390/pci/pci_event.c:101 __zpci_event_availability() error: we previously assumed 'zdev->zbus' could be null (see line 83) vim +101 arch/s390/pci/pci_event.c aa3b7c296732b43 Sebastian Ott 2013-12-12 76 static void __zpci_event_availability(struct zpci_ccdf_avail *ccdf) cbc0dd1f856b52b Jan Glauber 2012-11-29 77 { cbc0dd1f856b52b Jan Glauber 2012-11-29 78 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); 9a99649f2a89fdf Sebastian Ott 2016-01-29 79 struct pci_dev *pdev = NULL; 623bd44d3f277b7 Sebastian Ott 2017-05-09 80 enum zpci_state state; d795ddad36cbc82 Sebastian Ott 2013-11-15 81 int ret; cbc0dd1f856b52b Jan Glauber 2012-11-29 82 05bc1be6db4b268 Pierre Morel2020-03-23 @83 if (zdev && zdev->zbus && zdev->zbus->bus) ^ Check for NULL 44510d6fa0c00aa Pierre Morel2020-04-22 84 pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); 9a99649f2a89fdf Sebastian Ott 2016-01-29 85 1f1dcbd4f23bd1f Sebastian Ott 2013-10-22 86 zpci_err("avail CCDF:\n"); 1f1dcbd4f23bd1f Sebastian Ott 2013-10-22 87 zpci_err_hex(ccdf, sizeof(*ccdf)); cbc0dd1f856b52b Jan Glauber 2012-11-29 88 cbc0dd1f856b52b Jan Glauber 2012-11-29 89 switch (ccdf->pec) { 7fc611ff3ff1a0b Sebastian Ott 2015-06-16 90 case 0x0301: /* Reserved|Standby -> Configured */ 7fc611ff3ff1a0b Sebastian Ott 2015-06-16 91 if (!zdev) { f606b3ef47c9f87 Pierre Morel2020-03-25 92 ret = clp_add_pci_device(ccdf->fid, ccdf->fh, 1); 7fc611ff3ff1a0b Sebastian Ott 2015-06-16 93 break; 7fc611ff3ff1a0b Sebastian Ott 2015-06-16 94 } fcf2f402937a669 Sebastian Ott 2013-12-18 95 zdev->fh = ccdf->fh; f606b3ef47c9f87 Pierre Morel2020-03-25 96 zdev->state = ZPCI_FN_STATE_CONFIGURED; 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 97 ret = zpci_enable_device(zdev); 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 98 if (ret) 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 99 break; 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 100 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 @101 pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); Unchecked dereference 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 102 if (!pdev) 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 103 break; 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 104 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 105 pci_bus_add_device(pdev); 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 106 pci_lock_rescan_remove(); 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 107 pci_bus_add_devices(zdev->zbus->bus); 3047766bc6ec9c6 Niklas Schnelle 2020-06-18 108 pci_unlock_rescan_remove(); cbc0dd1f856b52b Jan Glauber 2012-11-29 109 break; d795ddad36cbc82 Sebastian Ott 2013-11-15 110 case 0x0302: /* Reserved -> Standby */ f606b3ef47c9f87 Pierre Morel2020-03-25 111 if (!zdev) { d795ddad36cbc82 Sebastian Ott 2013-11-15 112 clp_add_pci_device(ccdf->fid, ccdf->fh, 0); cbc0dd1f856b52b Jan Glauber 2012-11-29 113 break; f606b3ef47c9f87 Pierre Morel2020-03-25 114 } f606b3ef47c9f87 Pierre Morel2020-03-25 115 zdev->fh = ccdf->fh; f606b3ef47c9f87 Pierre Morel2020-03-25 116 break; d795ddad36cbc82 Sebastian Ott 2013-11-15 117 case 0x0303: /* Deconfiguration requested */ 623bd44d3f277b7 Sebastian Ott 2017-05-09 118 if (!zdev) 623bd44d3f277b7 Sebastian Ott 2017-05-09 119 break; d795ddad36cbc82 Sebastian Ott 2013-11-15 120 if (pdev) 2a01bd1bd3d28d1 Sebastian Ott 2015-07-28 121 pci_stop_and_remove_bus_device_locked(pdev); cbc0dd1f856b52b Jan Glauber 2012-11-29 122 d795ddad36cbc82 Sebastian Ott 2013-11-15 123 ret = zpci_disable_device(zdev); d795ddad36cbc82 Sebastian Ott 2013-11-15 124 if (ret) d795ddad36cbc82 Seba
[tip: x86/platform] x86/platform/uv: Fix an error code in uv_hubs_init()
The following commit has been merged into the x86/platform branch of tip: Commit-ID: 18d047bd89b8c1f9ba3c9b2d2f7309c953b3ce97 Gitweb: https://git.kernel.org/tip/18d047bd89b8c1f9ba3c9b2d2f7309c953b3ce97 Author:Dan Carpenter AuthorDate:Wed, 02 Dec 2020 17:44:07 +03:00 Committer: Borislav Petkov CommitterDate: Thu, 03 Dec 2020 08:51:06 +01:00 x86/platform/uv: Fix an error code in uv_hubs_init() Return -ENOMEM on allocation failure instead of returning random stack memory contents. Fixes: 4fc2cf1f2daf ("x86/platform/uv: Add new uv_sysfs platform driver") Signed-off-by: Dan Carpenter Signed-off-by: Borislav Petkov Reviewed-by: Justin Ernst Link: https://lkml.kernel.org/r/X8eoN/jMAJb3H3iv@mwanda --- drivers/platform/x86/uv_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c index 54c3425..e17ce8c 100644 --- a/drivers/platform/x86/uv_sysfs.c +++ b/drivers/platform/x86/uv_sysfs.c @@ -248,6 +248,7 @@ static int uv_hubs_init(void) uv_hubs[i] = kzalloc(sizeof(*uv_hubs[i]), GFP_KERNEL); if (!uv_hubs[i]) { i--; + ret = -ENOMEM; goto err_hubs; }
[tip: x86/platform] x86/platform/uv: Fix an error code in uv_hubs_init()
The following commit has been merged into the x86/platform branch of tip: Commit-ID: fa4a379ecfa0c735e8979bb732fe5a1705a64052 Gitweb: https://git.kernel.org/tip/fa4a379ecfa0c735e8979bb732fe5a1705a64052 Author:Dan Carpenter AuthorDate:Wed, 02 Dec 2020 17:44:07 +03:00 Committer: Borislav Petkov CommitterDate: Wed, 02 Dec 2020 20:51:53 +01:00 x86/platform/uv: Fix an error code in uv_hubs_init() Return -ENOMEM on allocation failure instead of returning random stack memory contents. Fixes: 4fc2cf1f2daf ("x86/platform/uv: Add new uv_sysfs platform driver") Signed-off-by: Dan Carpenter Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/X8eoN/jMAJb3H3iv@mwanda --- drivers/platform/x86/uv_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c index 54c3425..e17ce8c 100644 --- a/drivers/platform/x86/uv_sysfs.c +++ b/drivers/platform/x86/uv_sysfs.c @@ -248,6 +248,7 @@ static int uv_hubs_init(void) uv_hubs[i] = kzalloc(sizeof(*uv_hubs[i]), GFP_KERNEL); if (!uv_hubs[i]) { i--; + ret = -ENOMEM; goto err_hubs; }
Re: [PATCH] pstore: Tidy up an error check
On Wed, Dec 02, 2020 at 11:25:46AM -0800, Kees Cook wrote: > On Wed, Dec 02, 2020 at 09:45:31AM +0300, Dan Carpenter wrote: > > The crypto_alloc_comp() function never returns NULL, it returns error > > pointers on error. > > > > Signed-off-by: Dan Carpenter > > I replied to an identical patch yesterday, actually: > https://lore.kernel.org/lkml/202012011215.B9BF24A6D@keescook/ > > Using IS_ERR_OR_NULL() is more robust, and this isn't fast path, so I'd > prefer to keep it that way. > The NULL return doesn't make any sense though because crypto_alloc_comp() isn't optional... When a function returns both error pointers and NULLs then the NULL is special kind of success. p = get_feature(); If "p" is an error pointer that means an error happened. If "p" is NULL that means the feature is disabled in the .config or whatever. We can't return a valid pointer because the feature doesn't exist but it's also not an error so it doesn't return an error pointer. The code should not print a warning, maybe an info level printk at most. Then the driver should continue operating with the feature turned off. Two of the callers for crypto_alloc_comp() check for error pointers and NULL and three only check for error pointers. It's inconsistent. regards, dan carpenter
[PATCH net-next] octeontx2-af: debugfs: delete dead code
These debugfs never return NULL so all this code will never be run. In the normal case, (and in this case particularly), the debugfs functions are not supposed to be checked for errors so all this error checking code can be safely deleted. Signed-off-by: Dan Carpenter --- .../marvell/octeontx2/af/rvu_debugfs.c| 255 -- 1 file changed, 52 insertions(+), 203 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c index c383efc6b90c..d27543c1a166 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c @@ -1368,119 +1368,52 @@ RVU_DEBUG_SEQ_FOPS(nix_qsize, nix_qsize_display, nix_qsize_write); static void rvu_dbg_nix_init(struct rvu *rvu, int blkaddr) { - const struct device *dev = >pdev->dev; struct nix_hw *nix_hw; - struct dentry *pfile; if (!is_block_implemented(rvu->hw, blkaddr)) return; if (blkaddr == BLKADDR_NIX0) { rvu->rvu_dbg.nix = debugfs_create_dir("nix", rvu->rvu_dbg.root); - if (!rvu->rvu_dbg.nix) { - dev_err(rvu->dev, "create debugfs dir failed for nix\n"); - return; - } nix_hw = >hw->nix[0]; } else { rvu->rvu_dbg.nix = debugfs_create_dir("nix1", rvu->rvu_dbg.root); - if (!rvu->rvu_dbg.nix) { - dev_err(rvu->dev, - "create debugfs dir failed for nix1\n"); - return; - } nix_hw = >hw->nix[1]; } - pfile = debugfs_create_file("sq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw, - _dbg_nix_sq_ctx_fops); - if (!pfile) - goto create_failed; - - pfile = debugfs_create_file("rq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw, - _dbg_nix_rq_ctx_fops); - if (!pfile) - goto create_failed; - - pfile = debugfs_create_file("cq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw, - _dbg_nix_cq_ctx_fops); - if (!pfile) - goto create_failed; - - pfile = debugfs_create_file("ndc_tx_cache", 0600, rvu->rvu_dbg.nix, - nix_hw, _dbg_nix_ndc_tx_cache_fops); - if (!pfile) - goto create_failed; - - pfile = debugfs_create_file("ndc_rx_cache", 0600, rvu->rvu_dbg.nix, - nix_hw, _dbg_nix_ndc_rx_cache_fops); - if (!pfile) - goto create_failed; - - pfile = debugfs_create_file("ndc_tx_hits_miss", 0600, rvu->rvu_dbg.nix, - nix_hw, - _dbg_nix_ndc_tx_hits_miss_fops); - if (!pfile) - goto create_failed; - - pfile = debugfs_create_file("ndc_rx_hits_miss", 0600, rvu->rvu_dbg.nix, - nix_hw, - _dbg_nix_ndc_rx_hits_miss_fops); - if (!pfile) - goto create_failed; - - pfile = debugfs_create_file("qsize", 0600, rvu->rvu_dbg.nix, rvu, - _dbg_nix_qsize_fops); - if (!pfile) - goto create_failed; - - return; -create_failed: - dev_err(dev, - "Failed to create debugfs dir/file for NIX blk\n"); - debugfs_remove_recursive(rvu->rvu_dbg.nix); + debugfs_create_file("sq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw, + _dbg_nix_sq_ctx_fops); + debugfs_create_file("rq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw, + _dbg_nix_rq_ctx_fops); + debugfs_create_file("cq_ctx", 0600, rvu->rvu_dbg.nix, nix_hw, + _dbg_nix_cq_ctx_fops); + debugfs_create_file("ndc_tx_cache", 0600, rvu->rvu_dbg.nix, nix_hw, + _dbg_nix_ndc_tx_cache_fops); + debugfs_create_file("ndc_rx_cache", 0600, rvu->rvu_dbg.nix, nix_hw, + _dbg_nix_ndc_rx_cache_fops); + debugfs_create_file("ndc_tx_hits_miss", 0600, rvu->rvu_dbg.nix, nix_hw, + _dbg_nix_ndc_tx_hits_miss_fops); + debugfs_create_file("ndc_rx_hits_miss", 0600, rvu->rvu_dbg.nix, nix_hw, + _dbg_nix_ndc_rx_hits_miss_fops); + debugfs_create_file("qsize", 0600, rvu->rvu_dbg.nix, rvu, + _dbg_nix_qsize_fops); } static
[PATCH] pstore: Tidy up an error check
The crypto_alloc_comp() function never returns NULL, it returns error pointers on error. Signed-off-by: Dan Carpenter --- fs/pstore/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 36714df37d5d..b7a2a2a31dee 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -315,7 +315,7 @@ static void allocate_buf_for_compression(void) } ctx = crypto_alloc_comp(zbackend->name, 0, 0); - if (IS_ERR_OR_NULL(ctx)) { + if (IS_ERR(ctx)) { kfree(buf); pr_err("crypto_alloc_comp('%s') failed: %ld\n", zbackend->name, PTR_ERR(ctx)); -- 2.29.2
Re: [PATCH 06/18] software_node: amend software_node_unregister_node_group() to perform unregistration of array in reverse order to be consistent with software_node_unregister_nodes()
Hi Daniel, url: https://github.com/0day-ci/linux/commits/Daniel-Scally/Add-functionality-to-ipu3-cio2-driver-allowing-software_node-connections-to-sensors-on-platforms-designed-for-Windows/20201130-214014 base: git://linuxtv.org/media_tree.git master config: i386-randconfig-m021-20201130 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/base/swnode.c:785 software_node_unregister_node_group() error: uninitialized symbol 'i'. vim +/i +785 drivers/base/swnode.c 02094d54870590a Andy Shevchenko 2020-04-08 778 void software_node_unregister_node_group(const struct software_node **node_group) 02094d54870590a Andy Shevchenko 2020-04-08 779 { 02094d54870590a Andy Shevchenko 2020-04-08 780 unsigned int i; 02094d54870590a Andy Shevchenko 2020-04-08 781 02094d54870590a Andy Shevchenko 2020-04-08 782 if (!node_group) 02094d54870590a Andy Shevchenko 2020-04-08 783 return; 02094d54870590a Andy Shevchenko 2020-04-08 784 7c7577c82672f0a Daniel Scally 2020-11-30 @785 while (node_group[i]->name) ^ The "i" is never initialized. 7c7577c82672f0a Daniel Scally 2020-11-30 786 i++; 7c7577c82672f0a Daniel Scally 2020-11-30 787 7c7577c82672f0a Daniel Scally 2020-11-30 788 while (i--) 9dcbac84244f32e Andy Shevchenko 2020-06-22 789 software_node_unregister(node_group[i]); It's a strange thing that they can only be unregistered in reverse order... Walter Harms is right when he points out that programmers are notoriously bad at counting backwards. 02094d54870590a Andy Shevchenko 2020-04-08 790 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH v2] media: rockchip: rkisp1: remove useless debugfs checks
The debugfs_create_dir() function never returns NULLs so this code will never be executed. It's not intended that callers will check for debugfs errors in the normal case and it's not necessary in this driver, so we can just delete this code. Signed-off-by: Dan Carpenter --- v2: Fix subject drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index 9af137e4967f..68da1eed753d 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -430,10 +430,6 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1) struct rkisp1_debug *debug = >debug; debug->debugfs_dir = debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); - if (!debug->debugfs_dir) { - dev_dbg(rkisp1->dev, "failed to create debugfs directory\n"); - return; - } debugfs_create_ulong("data_loss", 0444, debug->debugfs_dir, >data_loss); debugfs_create_ulong("outform_size_err", 0444, debug->debugfs_dir, -- 2.29.2
Re: [PATCH] media: rockchip: rkisp1: remove some dead code
On Mon, Nov 30, 2020 at 11:20:05AM -0300, Helen Koike wrote: > Hi Dan, > > Thank you for your patch. > > On 11/30/20 9:53 AM, Dan Carpenter wrote: > > The debugfs_create_dir() function never returns NULLs. It's not supposed > > to checked for errors in the normal case and there is no need to check > > in this function so let's just delete this dead code. > > > > Signed-off-by: Dan Carpenter > > --- > > drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 4 > > 1 file changed, 4 deletions(-) > > > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > > b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > > index 9af137e4967f..68da1eed753d 100644 > > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c > > @@ -430,10 +430,6 @@ static void rkisp1_debug_init(struct rkisp1_device > > *rkisp1) > > struct rkisp1_debug *debug = >debug; > > > > debug->debugfs_dir = debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); > > - if (!debug->debugfs_dir) { > > - dev_dbg(rkisp1->dev, "failed to create debugfs directory\n"); > > - return; > > - } > > I was taking a look at the debugfs_create_dir() code, and I saw it can > return ERR_PTR(), so ideally we should check for errors with IS_ERR() / > PTR_ERR(). Debugfs functions aren't meant to be error checked in the normal case. There are some drivers which dereference the dentry pointer so those need to check it but that's not very common and isn't the case here. I'm really sure this must be documented somewhere but I can't find it at all. :P But look at commit 057e212eae72 ("media: usb: uvc: no need to check return value of debugfs_create functions") for example. regards, dan carpenter
Re: [PATCH 000/141] Fix fall-through warnings for Clang
On Mon, Nov 23, 2020 at 05:32:51PM -0800, Nick Desaulniers wrote: > On Sun, Nov 22, 2020 at 8:17 AM Kees Cook wrote: > > > > On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > > > If none of the 140 patches here fix a real bug, and there is no change > > > to machine code then it sounds to me like a W=2 kind of a warning. > > > > FWIW, this series has found at least one bug so far: > > https://lore.kernel.org/lkml/CAFCwf11izHF=g1mGry1fE5kvFFFrxzhPSM6qKAO8gxSp=kr...@mail.gmail.com/ > > So looks like the bulk of these are: > switch (x) { > case 0: > ++x; > default: > break; > } This should not generate a warning. > > I have a patch that fixes those up for clang: > https://reviews.llvm.org/D91895 > > There's 3 other cases that don't quite match between GCC and Clang I > observe in the kernel: > switch (x) { > case 0: > ++x; > default: > goto y; > } > y:; This should generate a warning. > > switch (x) { > case 0: > ++x; > default: > return; > } Warn for this. > > switch (x) { > case 0: > ++x; > default: > ; > } Don't warn for this. If adding a break statement changes the flow of the code then warn about potentially missing break statements, but if it doesn't change anything then don't warn about it. regards, dan carpenter
Re: [PATCH 000/141] Fix fall-through warnings for Clang
On Sun, Nov 22, 2020 at 08:17:03AM -0800, Kees Cook wrote: > On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote: > > On Fri, 20 Nov 2020 11:30:40 -0800 Kees Cook wrote: > > > On Fri, Nov 20, 2020 at 10:53:44AM -0800, Jakub Kicinski wrote: > > > > On Fri, 20 Nov 2020 12:21:39 -0600 Gustavo A. R. Silva wrote: > > > > > This series aims to fix almost all remaining fall-through warnings in > > > > > order to enable -Wimplicit-fallthrough for Clang. > > > > > > > > > > In preparation to enable -Wimplicit-fallthrough for Clang, explicitly > > > > > add multiple break/goto/return/fallthrough statements instead of just > > > > > letting the code fall through to the next case. > > > > > > > > > > Notice that in order to enable -Wimplicit-fallthrough for Clang, this > > > > > change[1] is meant to be reverted at some point. So, this patch helps > > > > > to move in that direction. > > > > > > > > > > Something important to mention is that there is currently a > > > > > discrepancy > > > > > between GCC and Clang when dealing with switch fall-through to empty > > > > > case > > > > > statements or to cases that only contain a break/continue/return > > > > > statement[2][3][4]. > > > > > > > > Are we sure we want to make this change? Was it discussed before? > > > > > > > > Are there any bugs Clangs puritanical definition of fallthrough helped > > > > find? > > > > > > > > IMVHO compiler warnings are supposed to warn about issues that could > > > > be bugs. Falling through to default: break; can hardly be a bug?! > > > > > > It's certainly a place where the intent is not always clear. I think > > > this makes all the cases unambiguous, and doesn't impact the machine > > > code, since the compiler will happily optimize away any behavioral > > > redundancy. > > > > If none of the 140 patches here fix a real bug, and there is no change > > to machine code then it sounds to me like a W=2 kind of a warning. > > FWIW, this series has found at least one bug so far: > https://lore.kernel.org/lkml/CAFCwf11izHF=g1mGry1fE5kvFFFrxzhPSM6qKAO8gxSp=kr...@mail.gmail.com/ This is a fallthrough to a return and not to a break. That should trigger a warning. The fallthrough to a break should not generate a warning. The bug we're trying to fix is "missing break statement" but if the result of the bug is "we hit a break statement" then now we're just talking about style. GCC should limit itself to warning about potentially buggy code. regards, dan carpenter
[PATCH] bus: mhi: core: Fix error handling in mhi_register_controller()
There are a few problems with the error handling in this function. They mostly center around the alloc_ordered_workqueue() allocation. 1) If that allocation fails or if the kcalloc() prior to it fails then it leads to a NULL dereference when we call destroy_workqueue(mhi_cntrl->hiprio_wq). 2) The error code is not set. 3) The "mhi_cntrl->mhi_cmd" allocation is not freed. The error handling was slightly confusing and I re-ordered it to be in the exact mirror/reverse order of how things were allocated. I changed the label names to say what the goto does instead of describing where the goto comes from. Fixes: 8f7039787687 ("bus: mhi: core: Move to using high priority workqueue") Signed-off-by: Dan Carpenter --- drivers/bus/mhi/core/init.c | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 96cde9c0034c..f0697f433c2f 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -871,7 +871,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, sizeof(*mhi_cntrl->mhi_cmd), GFP_KERNEL); if (!mhi_cntrl->mhi_cmd) { ret = -ENOMEM; - goto error_alloc_cmd; + goto err_free_event; } INIT_LIST_HEAD(_cntrl->transition_list); @@ -886,7 +886,8 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, ("mhi_hiprio_wq", WQ_MEM_RECLAIM | WQ_HIGHPRI); if (!mhi_cntrl->hiprio_wq) { dev_err(mhi_cntrl->cntrl_dev, "Failed to allocate workqueue\n"); - goto error_alloc_cmd; + ret = -ENOMEM; + goto err_free_cmd; } mhi_cmd = mhi_cntrl->mhi_cmd; @@ -932,7 +933,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, SOC_HW_VERSION_OFFS, _info); if (ret) - goto error_alloc_dev; + goto err_destroy_wq; mhi_cntrl->family_number = (soc_info & SOC_HW_VERSION_FAM_NUM_BMSK) >> SOC_HW_VERSION_FAM_NUM_SHFT; @@ -946,7 +947,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, mhi_cntrl->index = ida_alloc(_controller_ida, GFP_KERNEL); if (mhi_cntrl->index < 0) { ret = mhi_cntrl->index; - goto error_ida_alloc; + goto err_destroy_wq; } /* Register controller with MHI bus */ @@ -954,7 +955,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, if (IS_ERR(mhi_dev)) { dev_err(mhi_cntrl->cntrl_dev, "Failed to allocate MHI device\n"); ret = PTR_ERR(mhi_dev); - goto error_alloc_dev; + goto err_ida_free; } mhi_dev->dev_type = MHI_DEVICE_CONTROLLER; @@ -967,7 +968,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, ret = device_add(_dev->dev); if (ret) - goto error_add_dev; + goto err_release_dev; mhi_cntrl->mhi_dev = mhi_dev; @@ -975,19 +976,17 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, return 0; -error_add_dev: +err_release_dev: put_device(_dev->dev); - -error_alloc_dev: +err_ida_free: ida_free(_controller_ida, mhi_cntrl->index); - -error_ida_alloc: +err_destroy_wq: + destroy_workqueue(mhi_cntrl->hiprio_wq); +err_free_cmd: kfree(mhi_cntrl->mhi_cmd); - -error_alloc_cmd: - vfree(mhi_cntrl->mhi_chan); +err_free_event: kfree(mhi_cntrl->mhi_event); - destroy_workqueue(mhi_cntrl->hiprio_wq); + vfree(mhi_cntrl->mhi_chan); return ret; } -- 2.29.2
Re: [PATCH 127/141] staging: qlge: Fix fall-through warnings for Clang
On Wed, Nov 25, 2020 at 01:42:57PM +0900, Benjamin Poirier wrote: > On 2020-11-20 12:39 -0600, Gustavo A. R. Silva wrote: > > In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning > > by explicitly adding a break statement instead of letting the code fall > > through to the next case. > > > > Link: https://github.com/KSPP/linux/issues/115 > > Signed-off-by: Gustavo A. R. Silva > > --- > > drivers/staging/qlge/qlge_main.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/staging/qlge/qlge_main.c > > b/drivers/staging/qlge/qlge_main.c > > index 27da386f9d87..c41b1373dcf8 100644 > > --- a/drivers/staging/qlge/qlge_main.c > > +++ b/drivers/staging/qlge/qlge_main.c > > @@ -1385,6 +1385,7 @@ static void ql_categorize_rx_err(struct ql_adapter > > *qdev, u8 rx_err, > > break; > > case IB_MAC_IOCB_RSP_ERR_CRC: > > stats->rx_crc_err++; > > + break; > > default: > > break; > > } > > In this instance, it think it would be more appropriate to remove the > "default" case. There are checkers which complain about that. (As a static checker developer myself, I think complaining about missing default cases is a waste of everyone's time). regards, dan carpenter
[PATCH] media: rockchip: rkisp1: remove some dead code
The debugfs_create_dir() function never returns NULLs. It's not supposed to checked for errors in the normal case and there is no need to check in this function so let's just delete this dead code. Signed-off-by: Dan Carpenter --- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c index 9af137e4967f..68da1eed753d 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c @@ -430,10 +430,6 @@ static void rkisp1_debug_init(struct rkisp1_device *rkisp1) struct rkisp1_debug *debug = >debug; debug->debugfs_dir = debugfs_create_dir(RKISP1_DRIVER_NAME, NULL); - if (!debug->debugfs_dir) { - dev_dbg(rkisp1->dev, "failed to create debugfs directory\n"); - return; - } debugfs_create_ulong("data_loss", 0444, debug->debugfs_dir, >data_loss); debugfs_create_ulong("outform_size_err", 0444, debug->debugfs_dir, -- 2.29.2
Re: [PATCH 109/141] net: netrom: Fix fall-through warnings for Clang
On Fri, Nov 20, 2020 at 12:38:15PM -0600, Gustavo A. R. Silva wrote: > In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple > warnings by explicitly adding multiple break statements instead of > letting the code fall through to the next case. > > Link: https://github.com/KSPP/linux/issues/115 > Signed-off-by: Gustavo A. R. Silva > --- > net/netrom/nr_route.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c > index 78da5eab252a..de0456073dc0 100644 > --- a/net/netrom/nr_route.c > +++ b/net/netrom/nr_route.c > @@ -266,6 +266,7 @@ static int __must_check nr_add_node(ax25_address *nr, > const char *mnemonic, > fallthrough; > case 2: > re_sort_routes(nr_node, 0, 1); > + break; > case 1: > break; > } > @@ -359,6 +360,7 @@ static int nr_del_node(ax25_address *callsign, > ax25_address *neighbour, struct n > fallthrough; > case 1: > nr_node->routes[1] = nr_node->routes[2]; > + fallthrough; Make this one a break like the others. > case 2: > break; > } > @@ -482,6 +484,7 @@ static int nr_dec_obs(void) > fallthrough; > case 1: > s->routes[1] = s->routes[2]; > + break; > case 2: > break; > } > @@ -529,6 +532,7 @@ void nr_rt_device_down(struct net_device *dev) > fallthrough; > case 1: > t->routes[1] = > t->routes[2]; > + break; > case 2: > break; > } regards, dan carpenter
Re: [PATCH] staging: mfd: hi6421-spmi-pmic: fix error return code in hi6421_spmi_pmic_probe()
Not necessarily related to your patch but it should just return -ENOMEM instead of the "goto irq_malloc;". drivers/staging/hikey9xx/hi6421-spmi-pmic.c 251 if (!gpio_is_valid(pmic->gpio)) 252 return -EINVAL; 253 254 ret = devm_gpio_request_one(dev, pmic->gpio, GPIOF_IN, "pmic"); 255 if (ret < 0) { 256 dev_err(dev, "failed to request gpio%d\n", pmic->gpio); 257 return ret; This is a direct return. 258 } 259 260 pmic->irq = gpio_to_irq(pmic->gpio); [ Edit. Actually I can see that the original author must have thought that this needed to be released but it doesn't. ] 261 262 hi6421_spmi_pmic_irq_prc(pmic); 263 264 pmic->irqs = devm_kzalloc(dev, HISI_IRQ_NUM * sizeof(int), GFP_KERNEL); 265 if (!pmic->irqs) { 266 ret = -ENOMEM; 267 goto irq_malloc; This is a goto with a ComeFrom style label name, which says where it is called from (The goto is at the place where irq_malloc fails). This is a useless label name because we can see from the line before that the alloc failed. What we want to know is what the goto does! 268 } 269 270 pmic->domain = irq_domain_add_simple(np, HISI_IRQ_NUM, 0, 271 _spmi_domain_ops, pmic); 272 if (!pmic->domain) { 273 dev_err(dev, "failed irq domain add simple!\n"); 274 ret = -ENODEV; 275 goto irq_malloc; Here the label name is even more useless here because "irq_malloc" didn't fail on the line before. #Confusing But we still don't know what the goto does. If we scroll down then we see that "goto irq_malloc" releases the IRQ. A better name would be "goto err_irq;" 276 } 277 278 for (i = 0; i < HISI_IRQ_NUM; i++) { 279 virq = irq_create_mapping(pmic->domain, i); 280 if (!virq) { 281 dev_err(dev, "Failed mapping hwirq\n"); 282 ret = -ENOSPC; 283 goto irq_malloc; 284 } 285 pmic->irqs[i] = virq; 286 dev_dbg(dev, "%s: pmic->irqs[%d] = %d\n", 287 __func__, i, pmic->irqs[i]); 288 } 289 290 ret = request_threaded_irq(pmic->irq, hi6421_spmi_irq_handler, NULL, 291 IRQF_TRIGGER_LOW | IRQF_SHARED | IRQF_NO_SUSPEND, 292 "pmic", pmic); Except it turns out that we don't actually request the IRQ until this line. So those earlier "goto err_irq;" things are bogus. 293 if (ret < 0) { 294 dev_err(dev, "could not claim pmic IRQ: error %d\n", ret); 295 goto irq_malloc; 296 } 297 298 dev_set_drvdata(>dev, pmic); 299 300 /* 301 * The logic below will rely that the pmic is already stored at 302 * drvdata. 303 */ 304 dev_dbg(>dev, "SPMI-PMIC: adding children for %pOF\n", 305 pdev->dev.of_node); 306 ret = devm_mfd_add_devices(>dev, PLATFORM_DEVID_NONE, 307 hi6421v600_devs, ARRAY_SIZE(hi6421v600_devs), 308 NULL, 0, NULL); 309 if (!ret) 310 return 0; This is "success handling" anti-pattern and "last condition is weird" anti-pattern. We should always do failure handling. The code should look like: success(); success(); success(); success(); if () { failure(); failure(); failure(); } success(); success(); if () { failure(); failure(); failure(); } Failure is indented twice and success once. 311 312 dev_err(dev, "Failed to add child devices: %d\n", ret); 313 314 irq_malloc: 315 free_irq(pmic->irq, pmic); This free should only be done if devm_mfd_add_devices() fails. I don't know what happens if you free an IRQ which has not been requested. I think it triggers a WARN(). 316 317 return ret; 318 } regards, dan carpenter
Re: drivers/net/ethernet/freescale/gianfar.c:580 gfar_parse_group() warn: 'grp->regs' not released on lines: 517.
On Tue, Nov 17, 2020 at 01:41:15AM +, Leo Li wrote: > > ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil > > 2013-01-29 513 gfar_irq(grp, ER)->irq = > > irq_of_parse_and_map(np, 2); > > fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown > > 2015-11-26 514 if (!gfar_irq(grp, TX)->irq || > > fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown > > 2015-11-26 515 !gfar_irq(grp, RX)->irq || > > fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown > > 2015-11-26 516 !gfar_irq(grp, ER)->irq) > > 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet > > 2009-11- > > 02 517 return -EINVAL; > > > > This should unmap "grp->regs". > > This variable is unmapped in the caller with a wholesale cleanup function > unmap_group_regs(). Probably a false positive for smatch? > Yeah. Thanks. Smatch doesn't consider that the variable might be freed in the caller. regards, dan carpenter
Re: drivers/gpu/drm/i915/gem/i915_gem_throttle.c:59 i915_gem_throttle_ioctl() error: double locked 'ctx->engines_mutex' (orig line 59)
On Mon, Nov 16, 2020 at 10:15:04AM +, Chris Wilson wrote: > Quoting Dan Carpenter (2020-11-16 10:08:38) > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > > master > > head: 0062442ecfef0d82cd69e3e600d5006357f8d8e4 > > commit: 27a5dcfe73f4b696b3de8c23a560199bb1c193a4 drm/i915/gem: Remove > > disordered per-file request list for throttling > > config: i386-randconfig-m021-20201115 (attached as .config) > > compiler: gcc-9 (Debian 9.3.0-15) 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/i915/gem/i915_gem_throttle.c:59 i915_gem_throttle_ioctl() > > error: double locked 'ctx->engines_mutex' (orig line 59) > > > > vim +59 drivers/gpu/drm/i915/gem/i915_gem_throttle.c > > > > 35 int > > 36 i915_gem_throttle_ioctl(struct drm_device *dev, void *data, > > 37 struct drm_file *file) > > 38 { > > 39 const unsigned long recent_enough = jiffies - > > DRM_I915_THROTTLE_JIFFIES; > > 40 struct drm_i915_file_private *file_priv = file->driver_priv; > > 41 struct i915_gem_context *ctx; > > 42 unsigned long idx; > > 43 long ret; > > 44 > > 45 /* ABI: return -EIO if already wedged */ > > 46 ret = intel_gt_terminally_wedged(_i915(dev)->gt); > > 47 if (ret) > > 48 return ret; > > 49 > > 50 rcu_read_lock(); > > 51 xa_for_each(_priv->context_xa, idx, ctx) { > > 52 struct i915_gem_engines_iter it; > > 53 struct intel_context *ce; > > 54 > > 55 if (!kref_get_unless_zero(>ref)) > > 56 continue; > > 57 rcu_read_unlock(); > > 58 > > 59 for_each_gem_engine(ce, > > 60 > > i915_gem_context_lock_engines(ctx), > > > > ^^ > > I don't understand why this takes the lock every iteration through the > > loop > > It doesn't. > > static inline struct i915_gem_engines * > i915_gem_context_lock_engines(struct i915_gem_context *ctx) > __acquires(>engines_mutex) > { > mutex_lock(>engines_mutex); > return i915_gem_context_engines(ctx); > } > > static inline void > i915_gem_context_unlock_engines(struct i915_gem_context *ctx) > __releases(>engines_mutex) > { > mutex_unlock(>engines_mutex); > } > > with the i915_gem_engines stored as a local in the iterator at the start > of the for loop. Yeah... But that's true enough. But what I think is actually causing the static checker warning are the continues. 52 xa_for_each(_priv->context_xa, idx, ctx) { 53 struct i915_gem_engines_iter it; 54 struct intel_context *ce; 55 56 if (!kref_get_unless_zero(>ref)) 57 continue; 58 rcu_read_unlock(); 59 60 for_each_gem_engine(ce, 61 i915_gem_context_lock_engines(ctx), 62 it) { 63 struct i915_request *rq, *target = NULL; 64 65 if (!ce->timeline) 66 continue; ^ This continue is for the inside loop, so "ctx" isn't iterated. There is another continue as well later in the loop. Potentially they could be replaced with breaks? 67 68 mutex_lock(>timeline->mutex); 69 list_for_each_entry_reverse(rq, 70 >timeline->requests, 71 link) { 72 if (i915_request_completed(rq)) regards, dan carpenter
drivers/gpu/drm/i915/gem/i915_gem_throttle.c:59 i915_gem_throttle_ioctl() error: double locked 'ctx->engines_mutex' (orig line 59)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 0062442ecfef0d82cd69e3e600d5006357f8d8e4 commit: 27a5dcfe73f4b696b3de8c23a560199bb1c193a4 drm/i915/gem: Remove disordered per-file request list for throttling config: i386-randconfig-m021-20201115 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/i915/gem/i915_gem_throttle.c:59 i915_gem_throttle_ioctl() error: double locked 'ctx->engines_mutex' (orig line 59) vim +59 drivers/gpu/drm/i915/gem/i915_gem_throttle.c 35 int 36 i915_gem_throttle_ioctl(struct drm_device *dev, void *data, 37 struct drm_file *file) 38 { 39 const unsigned long recent_enough = jiffies - DRM_I915_THROTTLE_JIFFIES; 40 struct drm_i915_file_private *file_priv = file->driver_priv; 41 struct i915_gem_context *ctx; 42 unsigned long idx; 43 long ret; 44 45 /* ABI: return -EIO if already wedged */ 46 ret = intel_gt_terminally_wedged(_i915(dev)->gt); 47 if (ret) 48 return ret; 49 50 rcu_read_lock(); 51 xa_for_each(_priv->context_xa, idx, ctx) { 52 struct i915_gem_engines_iter it; 53 struct intel_context *ce; 54 55 if (!kref_get_unless_zero(>ref)) 56 continue; 57 rcu_read_unlock(); 58 59 for_each_gem_engine(ce, 60 i915_gem_context_lock_engines(ctx), ^^ I don't understand why this takes the lock every iteration through the loop 61 it) { 62 struct i915_request *rq, *target = NULL; 63 64 if (!ce->timeline) 65 continue; 66 67 mutex_lock(>timeline->mutex); 68 list_for_each_entry_reverse(rq, 69 >timeline->requests, 70 link) { 71 if (i915_request_completed(rq)) 72 break; 73 74 if (time_after(rq->emitted_jiffies, 75 recent_enough)) 76 continue; 77 78 target = i915_request_get(rq); 79 break; 80 } 81 mutex_unlock(>timeline->mutex); 82 if (!target) 83 continue; 84 85 ret = i915_request_wait(target, 86 I915_WAIT_INTERRUPTIBLE, 87 MAX_SCHEDULE_TIMEOUT); 88 i915_request_put(target); 89 if (ret < 0) 90 break; 91 } 92 i915_gem_context_unlock_engines(ctx); But only unlocks the last element 93 i915_gem_context_put(ctx); 94 95 rcu_read_lock(); 96 } 97 rcu_read_unlock(); 98 99 return ret < 0 ? ret : 0; 100 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
drivers/gpu/drm/mcde/mcde_display.c:543 mcde_configure_channel() error: uninitialized symbol 'val'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: e28c0d7c92c89016c12a677616668957351e7542 commit: 709c27730a11d6681297d733eb8ee18166e9c38a drm/mcde: Fix display data flow control config: i386-randconfig-m021-20201115 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/mcde/mcde_display.c:543 mcde_configure_channel() error: uninitialized symbol 'val'. vim +/val +543 drivers/gpu/drm/mcde/mcde_display.c 5fc537bfd00033a Linus Walleij 2019-05-24 458 static void mcde_configure_channel(struct mcde *mcde, enum mcde_channel ch, 5fc537bfd00033a Linus Walleij 2019-05-24 459 enum mcde_fifo fifo, 5fc537bfd00033a Linus Walleij 2019-05-24 460 const struct drm_display_mode *mode) 5fc537bfd00033a Linus Walleij 2019-05-24 461 { 5fc537bfd00033a Linus Walleij 2019-05-24 462 u32 val; 5fc537bfd00033a Linus Walleij 2019-05-24 463 u32 conf; 5fc537bfd00033a Linus Walleij 2019-05-24 464 u32 sync; 5fc537bfd00033a Linus Walleij 2019-05-24 465 u32 stat; 5fc537bfd00033a Linus Walleij 2019-05-24 466 u32 bgcol; 5fc537bfd00033a Linus Walleij 2019-05-24 467 u32 mux; 5fc537bfd00033a Linus Walleij 2019-05-24 468 5fc537bfd00033a Linus Walleij 2019-05-24 469 switch (ch) { 5fc537bfd00033a Linus Walleij 2019-05-24 470 case MCDE_CHANNEL_0: 5fc537bfd00033a Linus Walleij 2019-05-24 471 conf = MCDE_CHNL0CONF; 5fc537bfd00033a Linus Walleij 2019-05-24 472 sync = MCDE_CHNL0SYNCHMOD; 5fc537bfd00033a Linus Walleij 2019-05-24 473 stat = MCDE_CHNL0STAT; 5fc537bfd00033a Linus Walleij 2019-05-24 474 bgcol = MCDE_CHNL0BCKGNDCOL; 5fc537bfd00033a Linus Walleij 2019-05-24 475 mux = MCDE_CHNL0MUXING; 5fc537bfd00033a Linus Walleij 2019-05-24 476 break; 5fc537bfd00033a Linus Walleij 2019-05-24 477 case MCDE_CHANNEL_1: 5fc537bfd00033a Linus Walleij 2019-05-24 478 conf = MCDE_CHNL1CONF; 5fc537bfd00033a Linus Walleij 2019-05-24 479 sync = MCDE_CHNL1SYNCHMOD; 5fc537bfd00033a Linus Walleij 2019-05-24 480 stat = MCDE_CHNL1STAT; 5fc537bfd00033a Linus Walleij 2019-05-24 481 bgcol = MCDE_CHNL1BCKGNDCOL; 5fc537bfd00033a Linus Walleij 2019-05-24 482 mux = MCDE_CHNL1MUXING; 5fc537bfd00033a Linus Walleij 2019-05-24 483 break; 5fc537bfd00033a Linus Walleij 2019-05-24 484 case MCDE_CHANNEL_2: 5fc537bfd00033a Linus Walleij 2019-05-24 485 conf = MCDE_CHNL2CONF; 5fc537bfd00033a Linus Walleij 2019-05-24 486 sync = MCDE_CHNL2SYNCHMOD; 5fc537bfd00033a Linus Walleij 2019-05-24 487 stat = MCDE_CHNL2STAT; 5fc537bfd00033a Linus Walleij 2019-05-24 488 bgcol = MCDE_CHNL2BCKGNDCOL; 5fc537bfd00033a Linus Walleij 2019-05-24 489 mux = MCDE_CHNL2MUXING; 5fc537bfd00033a Linus Walleij 2019-05-24 490 break; 5fc537bfd00033a Linus Walleij 2019-05-24 491 case MCDE_CHANNEL_3: 5fc537bfd00033a Linus Walleij 2019-05-24 492 conf = MCDE_CHNL3CONF; 5fc537bfd00033a Linus Walleij 2019-05-24 493 sync = MCDE_CHNL3SYNCHMOD; 5fc537bfd00033a Linus Walleij 2019-05-24 494 stat = MCDE_CHNL3STAT; 5fc537bfd00033a Linus Walleij 2019-05-24 495 bgcol = MCDE_CHNL3BCKGNDCOL; 5fc537bfd00033a Linus Walleij 2019-05-24 496 mux = MCDE_CHNL3MUXING; 5fc537bfd00033a Linus Walleij 2019-05-24 497 return; 5fc537bfd00033a Linus Walleij 2019-05-24 498 } 5fc537bfd00033a Linus Walleij 2019-05-24 499 5fc537bfd00033a Linus Walleij 2019-05-24 500 /* Set up channel 0 sync (based on chnl_update_registers()) */ 709c27730a11d66 Linus Walleij 2020-07-29 501 switch (mcde->flow_mode) { 709c27730a11d66 Linus Walleij 2020-07-29 502 case MCDE_COMMAND_ONESHOT_FLOW: 709c27730a11d66 Linus Walleij 2020-07-29 503 /* Oneshot is achieved with software sync */ 709c27730a11d66 Linus Walleij 2020-07-29 504 val = MCDE_CHNLXSYNCHMOD_SRC_SYNCH_SOFTWARE 709c27730a11d66 Linus Walleij 2020-07-29 505 << MCDE_CHNLXSYNCHMOD_SRC_SYNCH_SHIFT; 709c27730a11d66 Linus Walleij 2020-07-29 506 break; 709c27730a11d66 Linus Walleij 2020-07-29 507 case MCDE_COMMAND_TE_FLOW: 5fc537bfd00033a Linus Walleij 2019-05-24 508 val = MCDE_CHNLXSYNCHMOD_SRC_SYNCH_HARDWARE 5fc537bfd00033a Linus Walleij 2019-0
drivers/net/ethernet/freescale/gianfar.c:580 gfar_parse_group() warn: 'grp->regs' not released on lines: 517.
Hi Rasmus, First bad commit (maybe != root cause): tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1 commit: 5a35435ef4e6e4bd2aabd6706b146b298a9cffe5 soc: fsl: qe: remove PPC32 dependency from CONFIG_QUICC_ENGINE config: powerpc64-randconfig-m031-20201113 (attached as .config) compiler: powerpc64-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/freescale/gianfar.c:580 gfar_parse_group() warn: 'grp->regs' not released on lines: 517. vim +580 drivers/net/ethernet/freescale/gianfar.c 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 491 static int gfar_parse_group(struct device_node *np, 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 492 struct gfar_private *priv, const char *model) 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 493 { 5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 494 struct gfar_priv_grp *grp = >gfargrp[priv->num_grps]; ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 495 int i; ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 496 ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 497 for (i = 0; i < GFAR_NUM_IRQS; i++) { ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 498 grp->irqinfo[i] = kzalloc(sizeof(struct gfar_irqinfo), ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 499 GFP_KERNEL); ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 500 if (!grp->irqinfo[i]) ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 501 return -ENOMEM; ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 502 } 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 503 5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 504 grp->regs = of_iomap(np, 0); ^^^ 5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 505 if (!grp->regs) 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 506 return -ENOMEM; 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 507 ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 508 gfar_irq(grp, TX)->irq = irq_of_parse_and_map(np, 0); 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 509 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 510 /* If we aren't the FEC we have multiple interrupts */ 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 511 if (model && strcasecmp(model, "FEC")) { ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 512 gfar_irq(grp, RX)->irq = irq_of_parse_and_map(np, 1); ee873fda3bec7c6 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 513 gfar_irq(grp, ER)->irq = irq_of_parse_and_map(np, 2); fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown 2015-11-26 514 if (!gfar_irq(grp, TX)->irq || fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown 2015-11-26 515 !gfar_irq(grp, RX)->irq || fea0f6650979a4f drivers/net/ethernet/freescale/gianfar.c Mark Brown 2015-11-26 516 !gfar_irq(grp, ER)->irq) 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 517 return -EINVAL; This should unmap "grp->regs". 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 518 } 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 519 5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 520 grp->priv = priv; 5fedcc14d40e355 drivers/net/ethernet/freescale/gianfar.c Claudiu Manoil 2013-01-29 521 spin_lock_init(>grplock); 46ceb60ca80fa07 drivers/net/gianfar.cSandeep Gopalpet 2009-11-02 522 if (priv->mode == MQ_MG_MODE) { 55917641
drivers/mmc/host/tmio_mmc.c:177 tmio_mmc_probe() warn: argument 3 to %08lx specifier is cast from pointer
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: f01c30de86f1047e9bae1b1b1417b0ce8dcd15b1 commit: 54d8454436a205682bd89d66d8d9eedbc8452d15 mmc: host: Enable compile testing of multiple drivers config: arm64-randconfig-m031-20201113 (attached as .config) compiler: aarch64-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/mmc/host/tmio_mmc.c:177 tmio_mmc_probe() warn: argument 3 to %08lx specifier is cast from pointer vim +177 drivers/mmc/host/tmio_mmc.c 94b110aff8679b1 Kuninori Morimoto 2015-01-13 170 de501af98dfab9c Ian Molton2015-04-27 171 ret = devm_request_irq(>dev, irq, tmio_mmc_irq, de501af98dfab9c Ian Molton2015-04-27 172 IRQF_TRIGGER_FALLING, d9618e9f1a057ef Yong Zhang2011-09-22 173 dev_name(>dev), host); 8e7bfdb37ac001c Magnus Damm 2011-05-06 174 if (ret) 8e7bfdb37ac001c Magnus Damm 2011-05-06 175 goto host_remove; 8e7bfdb37ac001c Magnus Damm 2011-05-06 176 311f3ac76826bfd Guennadi Liakhovetski 2010-05-19 @177 pr_info("%s at 0x%08lx irq %d\n", mmc_hostname(host->mmc), ^^^ These are supposed to be %p so that the kernel can hide them and avoid showing kernel pointers to user space. 8e7bfdb37ac001c Magnus Damm 2011-05-06 178 (unsigned long)host->ctl, irq); 4a48998fa16121d Ian Molton2008-07-15 179 4a48998fa16121d Ian Molton2008-07-15 180 return 0; 4a48998fa16121d Ian Molton2008-07-15 181 8e7bfdb37ac001c Magnus Damm 2011-05-06 182 host_remove: 8e7bfdb37ac001c Magnus Damm 2011-05-06 183 tmio_mmc_host_remove(host); 94b110aff8679b1 Kuninori Morimoto 2015-01-13 184 host_free: 94b110aff8679b1 Kuninori Morimoto 2015-01-13 185 tmio_mmc_host_free(host); 7ee422dc6e947fc Magnus Damm 2010-02-17 186 cell_disable: 7ee422dc6e947fc Magnus Damm 2010-02-17 187 if (cell->disable) b6147490e6aac82 Guennadi Liakhovetski 2011-03-23 188 cell->disable(pdev); 4a48998fa16121d Ian Molton2008-07-15 189 out: 4a48998fa16121d Ian Molton2008-07-15 190 return ret; 4a48998fa16121d Ian Molton2008-07-15 191 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [bug report] sched/fair: Prefer prev cpu in asymmetric wakeup path
On Fri, Nov 13, 2020 at 09:56:37AM +0100, Vincent Guittot wrote: > Hi Dan, > > Le vendredi 13 nov. 2020 à 11:46:57 (+0300), Dan Carpenter a écrit : > > Hello Vincent Guittot, > > > > The patch b4c9c9f15649: "sched/fair: Prefer prev cpu in asymmetric > > wakeup path" from Oct 29, 2020, leads to the following static checker > > warning: > > > > kernel/sched/fair.c:6249 select_idle_sibling() > > error: uninitialized symbol 'task_util'. > > > > kernel/sched/fair.c > > 6233 static int select_idle_sibling(struct task_struct *p, int prev, int > > target) > > 6234 { > > 6235 struct sched_domain *sd; > > 6236 unsigned long task_util; > > 6237 int i, recent_used_cpu; > > 6238 > > 6239 /* > > 6240 * On asymmetric system, update task utilization because we > > will check > > 6241 * that the task fits with cpu's capacity. > > 6242 */ > > > > The original comment was a bit more clear... Perhaps "On asymmetric > > system[s], [record the] task utilization because we will check that the > > task [can be done within] the cpu's capacity." > > The comment "update task utilization because we will check ..." refers to > sync_entity_load_avg() > > > > > 6243 if (static_branch_unlikely(_asym_cpucapacity)) { > > 6244 sync_entity_load_avg(>se); > > 6245 task_util = uclamp_task_util(p); > > 6246 } > > > > "task_util" is not initialized on the else path. > > no need because it will not be used > > > > > 6247 > > 6248 if ((available_idle_cpu(target) || sched_idle_cpu(target)) > > && > > 6249 asym_fits_capacity(task_util, target)) > >^ > > Uninitialized variable warning. > > asym_fits_capacity includes the same condition as above when we set task_util > so task_util can't be used unintialize > > static inline bool asym_fits_capacity(int task_util, int cpu) > { > if (static_branch_unlikely(_asym_cpucapacity)) > return fits_capacity(task_util, capacity_of(cpu)); > > return true; It's an interesting question, because unless the compiler makes this inline, then it will lead to a KASan/syzbot warning at runtime. The function is, of course, marked as inline but the compiler, also of course, generally ignores those hints (use __always_inline if you want the compiler to pay attention). On the other hand, the compiler will still probably inline it... So this is *probably* not going to lead to a runtime warning. regards, dan carpenter
[PATCH] clk: qcom: lpass-sc7180: Clean up on error in lpass_sc7180_init()
Clean up the first driver if the second driver can't be registered. Fixes: 4ee9fe3e292b ("clk: qcom: lpass-sc7180: Disentangle the two clock devices") Signed-off-by: Dan Carpenter --- drivers/clk/qcom/lpasscorecc-sc7180.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/lpasscorecc-sc7180.c b/drivers/clk/qcom/lpasscorecc-sc7180.c index 1a3925badd7c..9081649f476f 100644 --- a/drivers/clk/qcom/lpasscorecc-sc7180.c +++ b/drivers/clk/qcom/lpasscorecc-sc7180.c @@ -491,7 +491,13 @@ static int __init lpass_sc7180_init(void) if (ret) return ret; - return platform_driver_register(_hm_sc7180_driver); + ret = platform_driver_register(_hm_sc7180_driver); + if (ret) { + platform_driver_unregister(_core_cc_sc7180_driver); + return ret; + } + + return 0; } subsys_initcall(lpass_sc7180_init); -- 2.28.0
[PATCH] soc: aspeed: Fix a reference leak in aspeed_socinfo_init()
This needs to call of_node_put(np) before returning if of_iomap() fails. Fixes: e0218dca5787 ("soc: aspeed: Add soc info driver") Signed-off-by: Dan Carpenter --- drivers/soc/aspeed/aspeed-socinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/aspeed/aspeed-socinfo.c b/drivers/soc/aspeed/aspeed-socinfo.c index 20a1d4aeb051..773930e0cb10 100644 --- a/drivers/soc/aspeed/aspeed-socinfo.c +++ b/drivers/soc/aspeed/aspeed-socinfo.c @@ -74,8 +74,10 @@ static int __init aspeed_socinfo_init(void) } reg = of_iomap(np, 0); - if (!reg) + if (!reg) { + of_node_put(np); return -ENODEV; + } siliconid = readl(reg); iounmap(reg); -- 2.28.0
[bug report] sched/fair: Prefer prev cpu in asymmetric wakeup path
Hello Vincent Guittot, The patch b4c9c9f15649: "sched/fair: Prefer prev cpu in asymmetric wakeup path" from Oct 29, 2020, leads to the following static checker warning: kernel/sched/fair.c:6249 select_idle_sibling() error: uninitialized symbol 'task_util'. kernel/sched/fair.c 6233 static int select_idle_sibling(struct task_struct *p, int prev, int target) 6234 { 6235 struct sched_domain *sd; 6236 unsigned long task_util; 6237 int i, recent_used_cpu; 6238 6239 /* 6240 * On asymmetric system, update task utilization because we will check 6241 * that the task fits with cpu's capacity. 6242 */ The original comment was a bit more clear... Perhaps "On asymmetric system[s], [record the] task utilization because we will check that the task [can be done within] the cpu's capacity." 6243 if (static_branch_unlikely(_asym_cpucapacity)) { 6244 sync_entity_load_avg(>se); 6245 task_util = uclamp_task_util(p); 6246 } "task_util" is not initialized on the else path. 6247 6248 if ((available_idle_cpu(target) || sched_idle_cpu(target)) && 6249 asym_fits_capacity(task_util, target)) ^ Uninitialized variable warning. 6250 return target; 6251 6252 /* 6253 * If the previous CPU is cache affine and idle, don't be stupid: 6254 */ 6255 if (prev != target && cpus_share_cache(prev, target) && 6256 (available_idle_cpu(prev) || sched_idle_cpu(prev)) && 6257 asym_fits_capacity(task_util, prev)) 6258 return prev; 6259 6260 /* 6261 * Allow a per-cpu kthread to stack with the wakee if the regards, dan carpenter
[kbuild] net/core/devlink.c:4415:9: warning: Identical condition 'err', second condition is always false
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 3d5e28bff7ad55aea081c1af516cc1c94a5eca7d commit: 573ed90aa5e23b512168400ba6d65e592081944e devlink: Force enclosing array on binary fmsg data compiler: riscv64-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) >> net/core/devlink.c:4415:9: warning: Identical condition 'err', second >> condition is always false [identicalConditionAfterEarlyExit] return err; ^ net/core/devlink.c:4411:6: note: first condition if (err) ^ net/core/devlink.c:4415:9: note: second condition return err; ^ vim +/err +4415 net/core/devlink.c 573ed90aa5e23b Aya Levin 2020-02-11 4405 int devlink_fmsg_binary_pair_nest_start(struct devlink_fmsg *fmsg, 573ed90aa5e23b Aya Levin 2020-02-11 4406 const char *name) 573ed90aa5e23b Aya Levin 2020-02-11 4407 { 573ed90aa5e23b Aya Levin 2020-02-11 4408 int err; 573ed90aa5e23b Aya Levin 2020-02-11 4409 573ed90aa5e23b Aya Levin 2020-02-11 4410 err = devlink_fmsg_arr_pair_nest_start(fmsg, name); 573ed90aa5e23b Aya Levin 2020-02-11 4411 if (err) 573ed90aa5e23b Aya Levin 2020-02-11 4412 return err; 573ed90aa5e23b Aya Levin 2020-02-11 4413 573ed90aa5e23b Aya Levin 2020-02-11 4414 fmsg->putting_binary = true; 573ed90aa5e23b Aya Levin 2020-02-11 @4415 return err; Just "return 0;" 573ed90aa5e23b Aya Levin 2020-02-11 4416 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org ___ kbuild mailing list -- kbu...@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
Re: drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c:412 sun8i_ce_hash_run() warn: possible memory leak of 'result'
On Wed, Nov 11, 2020 at 09:01:34AM +0100, LABBE Corentin wrote: > On Tue, Nov 10, 2020 at 01:47:37PM +0300, Dan Carpenter wrote: > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > > master > > head: 407ab579637ced6dc32cfb2295afb7259cca4b22 > > commit: 56f6d5aee88d129b2424902cd630f10794550763 crypto: sun8i-ce - support > > hash algorithms > > config: x86_64-randconfig-m001-20201109 (attached as .config) > > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot > > Reported-by: Dan Carpenter > > > > Hello > > Thanks for the report, I will send a patch soon. > Note that you should send this report to the maintainer also (but this time > it is me with another address, so its fine). > These are automated emails from the kbuild bot. I just look over the Smatch warnings and forward them. It don't know how the CC list is chosen. I guess just from who signed off on the patch... My guess is that people would be annoyed if we CC'd more people. Generally, we have a really good success rate with people fixing these warnings. I recently had a case where the zero day bot email wasn't clear, but I caught that because I'm looking at new Smatch warnings on my own system. There was another case, where the bug was fixed and then re-introduced via a bad merge and we almost missed that because it was marked as old. Fortunately, I discoverd it while looking at a different bug. regards, dan carpenter
Re: [PATCH v1 11/30] drm/tegra: dc: Support OPP and SoC core voltage scaling
On Tue, Nov 10, 2020 at 09:29:45PM +0100, Thierry Reding wrote: > > + err = dev_pm_opp_of_add_table(dc->dev); > > + if (err) { > > + dev_err(dc->dev, "failed to add OPP table: %d\n", err); > > + goto put_hw; > > + } > > + > > + err = devm_add_action(dc->dev, tegra_dc_deinit_opp_table, dc); > > + if (err) > > + goto remove_table; > > Do these functions return positive values? If not, I'd prefer if this > check was more explicit (i.e. err < 0) for consistency with the rest of > this code. > Isn't it the other way around? It's only when the check is explicitly for "if (ret < 0)" that we have to wonder about positives. If the codes says "if (ret)" then we know that it doesn't return positive values and every non-zero is an error. In the kernel "if (ret)" is way more popular than "if (ret < 0)": $ git grep 'if (\(ret\|rc\|err\))' | wc -l 92927 $ git grep 'if (\(ret\|rc\|err\) < 0)' | wc -l 36577 And some of those are places where "ret" can be positive so we are forced to use the "if (ret < 0)" format. Checking for "if (ret)" is easier from a static analysis perspective. If it's one style is used consistently then they're the same but when there is a mismatch the "if (ret < 0) " will trigger a false positive and the "if (ret) " will not. int var; ret = frob(); if (ret < 0) return ret; Smatch thinks positive returns are not handled so it complains that "var can be uninitialized". regards, dan carpenter
Re: [PATCH v2 3/3] media: uapi: mpeg2: Split sequence and picture parameters
Hi Ezequiel, url: https://github.com/0day-ci/linux/commits/Ezequiel-Garcia/MPEG-2-stateless-API-cleanup/20201106-045304 base: git://linuxtv.org/media_tree.git master config: i386-randconfig-m021-20201110 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/media/v4l2-core/v4l2-ctrls.c:1809 std_validate_compound() warn: ignoring unreachable code. vim +1809 drivers/media/v4l2-core/v4l2-ctrls.c de8145452eebe55 Ezequiel Garcia 2019-07-11 1774 static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, 0176077a813933a Hans Verkuil 2014-04-27 1775 union v4l2_ctrl_ptr ptr) 0176077a813933a Hans Verkuil 2014-04-27 1776 { 0e380411d9f043f Ezequiel Garcia 2020-11-05 1777 struct v4l2_ctrl_mpeg2_sequence *p_mpeg2_sequence; 0e380411d9f043f Ezequiel Garcia 2020-11-05 1778 struct v4l2_ctrl_mpeg2_picture *p_mpeg2_picture; c27bb30e7b6d385 Paul Kocialkowski 2018-09-13 1779 struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; 298c62d3856111e Ezequiel Garcia 2019-07-11 1780 struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; d9358563179a7f0 Ezequiel Garcia 2020-08-25 1781 struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; f9879eb378295e8 Ezequiel Garcia 2020-08-25 1782 struct v4l2_ctrl_h264_decode_params *p_h264_dec_params; 256fa3920874b0f Paul Kocialkowski 2019-10-22 1783 struct v4l2_ctrl_hevc_sps *p_hevc_sps; 256fa3920874b0f Paul Kocialkowski 2019-10-22 1784 struct v4l2_ctrl_hevc_pps *p_hevc_pps; 256fa3920874b0f Paul Kocialkowski 2019-10-22 1785 struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; d1dc49370f8371b Ricardo Ribalda 2019-10-07 1786 struct v4l2_area *area; de8145452eebe55 Ezequiel Garcia 2019-07-11 1787 void *p = ptr.p + idx * ctrl->elem_size; 256fa3920874b0f Paul Kocialkowski 2019-10-22 1788 unsigned int i; de8145452eebe55 Ezequiel Garcia 2019-07-11 1789 de8145452eebe55 Ezequiel Garcia 2019-07-11 1790 switch ((u32)ctrl->type) { 0e380411d9f043f Ezequiel Garcia 2020-11-05 1791 case V4L2_CTRL_TYPE_MPEG2_SEQUENCE: 0e380411d9f043f Ezequiel Garcia 2020-11-05 1792 p_mpeg2_sequence = p; de8145452eebe55 Ezequiel Garcia 2019-07-11 1793 0e380411d9f043f Ezequiel Garcia 2020-11-05 1794 switch (p_mpeg2_sequence->chroma_format) { de8145452eebe55 Ezequiel Garcia 2019-07-11 1795 case 1: /* 4:2:0 */ de8145452eebe55 Ezequiel Garcia 2019-07-11 1796 case 2: /* 4:2:2 */ de8145452eebe55 Ezequiel Garcia 2019-07-11 1797 case 3: /* 4:4:4 */ de8145452eebe55 Ezequiel Garcia 2019-07-11 1798 break; de8145452eebe55 Ezequiel Garcia 2019-07-11 1799 default: de8145452eebe55 Ezequiel Garcia 2019-07-11 1800 return -EINVAL; de8145452eebe55 Ezequiel Garcia 2019-07-11 1801 } 0e380411d9f043f Ezequiel Garcia 2020-11-05 1802 zero_reserved(*p_mpeg2_sequence); 0e380411d9f043f Ezequiel Garcia 2020-11-05 1803 break; 0e380411d9f043f Ezequiel Garcia 2020-11-05 1804 0e380411d9f043f Ezequiel Garcia 2020-11-05 1805 case V4L2_CTRL_TYPE_MPEG2_PICTURE: 0e380411d9f043f Ezequiel Garcia 2020-11-05 1806 p_mpeg2_picture = p; 0e380411d9f043f Ezequiel Garcia 2020-11-05 1807 break; ^^ de8145452eebe55 Ezequiel Garcia 2019-07-11 1808 0e380411d9f043f Ezequiel Garcia 2020-11-05 @1809 switch (p_mpeg2_picture->intra_dc_precision) { ^^ Unreachable. de8145452eebe55 Ezequiel Garcia 2019-07-11 1810 case 0: /* 8 bits */ de8145452eebe55 Ezequiel Garcia 2019-07-11 1811 case 1: /* 9 bits */ de8145452eebe55 Ezequiel Garcia 2019-07-11 1812 case 2: /* 10 bits */ de8145452eebe55 Ezequiel Garcia 2019-07-11 1813 case 3: /* 11 bits */ de8145452eebe55 Ezequiel Garcia 2019-07-11 1814 break; de8145452eebe55 Ezequiel Garcia 2019-07-11 1815 default: de8145452eebe55 Ezequiel Garcia 2019-07-11 1816 return -EINVAL; de8145452eebe55 Ezequiel Garcia 2019-07-11 1817 } 0e380411d9f043f Ezequiel Garcia 2020-11-05 1818 break; de8145452eebe55 Ezequiel Garcia 2019-07-11 1819 .config.gz Description: application/gzip
Re: [PATCH v3 00/11] Introduce Simple atomic counters
On Fri, Oct 16, 2020 at 03:51:25PM -0700, Kees Cook wrote: > On Fri, Oct 16, 2020 at 12:53:13PM +0200, Peter Zijlstra wrote: > > That's like saying: "I'm too lazy to track what I've looked at already". > > You're basically proposing to graffiti "Kees was here -- 16/10/2020" all > > over the kernel. Just so you can see where you still need to go. > > > > It says the code was (assuming your audit was correct) good at that > > date, but has no guarantees for any moment after that. > > That kind of bit-rot marking is exactly what I would like to avoid: just > putting a comment in is pointless. Making the expectations of the usage > become _enforced_ is the goal. And having it enforced by the _compiler_ > is key. Just adding a meaningless attribute that a static checker > will notice some time and hope people fix them doesn't scale either > (just look at how many sparse warnings there are). Most Sparse warnings are false positives. People do actually fix the ones which matter. I think this patchset could be useful. I'm working on a refcounting check for Smatch. I want to warn about when we forget to drop a reference on an error path. Right now I just assume that anything with "error", "drop" or "->stats->" in the name is just a counter. regards, dan carpenter
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c:412 sun8i_ce_hash_run() warn: possible memory leak of 'result'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 407ab579637ced6dc32cfb2295afb7259cca4b22 commit: 56f6d5aee88d129b2424902cd630f10794550763 crypto: sun8i-ce - support hash algorithms config: x86_64-randconfig-m001-20201109 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/allwinner/sun8i-ce/sun8i-ce-hash.c:412 sun8i_ce_hash_run() warn: possible memory leak of 'result' vim +/result +412 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c 56f6d5aee88d129 Corentin Labbe 2020-09-18 249 int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) 56f6d5aee88d129 Corentin Labbe 2020-09-18 250 { 56f6d5aee88d129 Corentin Labbe 2020-09-18 251 struct ahash_request *areq = container_of(breq, struct ahash_request, base); 56f6d5aee88d129 Corentin Labbe 2020-09-18 252 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq); 56f6d5aee88d129 Corentin Labbe 2020-09-18 253 struct ahash_alg *alg = __crypto_ahash_alg(tfm->base.__crt_alg); 56f6d5aee88d129 Corentin Labbe 2020-09-18 254 struct sun8i_ce_hash_reqctx *rctx = ahash_request_ctx(areq); 56f6d5aee88d129 Corentin Labbe 2020-09-18 255 struct sun8i_ce_alg_template *algt; 56f6d5aee88d129 Corentin Labbe 2020-09-18 256 struct sun8i_ce_dev *ce; 56f6d5aee88d129 Corentin Labbe 2020-09-18 257 struct sun8i_ce_flow *chan; 56f6d5aee88d129 Corentin Labbe 2020-09-18 258 struct ce_task *cet; 56f6d5aee88d129 Corentin Labbe 2020-09-18 259 struct scatterlist *sg; 56f6d5aee88d129 Corentin Labbe 2020-09-18 260 int nr_sgs, flow, err; 56f6d5aee88d129 Corentin Labbe 2020-09-18 261 unsigned int len; 56f6d5aee88d129 Corentin Labbe 2020-09-18 262 u32 common; 56f6d5aee88d129 Corentin Labbe 2020-09-18 263 u64 byte_count; 56f6d5aee88d129 Corentin Labbe 2020-09-18 264 __le32 *bf; 56f6d5aee88d129 Corentin Labbe 2020-09-18 265 void *buf; 56f6d5aee88d129 Corentin Labbe 2020-09-18 266 int j, i, todo; 56f6d5aee88d129 Corentin Labbe 2020-09-18 267 int nbw = 0; 56f6d5aee88d129 Corentin Labbe 2020-09-18 268 u64 fill, min_fill; 56f6d5aee88d129 Corentin Labbe 2020-09-18 269 __be64 *bebits; 56f6d5aee88d129 Corentin Labbe 2020-09-18 270 __le64 *lebits; 56f6d5aee88d129 Corentin Labbe 2020-09-18 271 void *result; 56f6d5aee88d129 Corentin Labbe 2020-09-18 272 u64 bs; 56f6d5aee88d129 Corentin Labbe 2020-09-18 273 int digestsize; 56f6d5aee88d129 Corentin Labbe 2020-09-18 274 dma_addr_t addr_res, addr_pad; 56f6d5aee88d129 Corentin Labbe 2020-09-18 275 56f6d5aee88d129 Corentin Labbe 2020-09-18 276 algt = container_of(alg, struct sun8i_ce_alg_template, alg.hash); 56f6d5aee88d129 Corentin Labbe 2020-09-18 277 ce = algt->ce; 56f6d5aee88d129 Corentin Labbe 2020-09-18 278 56f6d5aee88d129 Corentin Labbe 2020-09-18 279 bs = algt->alg.hash.halg.base.cra_blocksize; 56f6d5aee88d129 Corentin Labbe 2020-09-18 280 digestsize = algt->alg.hash.halg.digestsize; 56f6d5aee88d129 Corentin Labbe 2020-09-18 281 if (digestsize == SHA224_DIGEST_SIZE) 56f6d5aee88d129 Corentin Labbe 2020-09-18 282 digestsize = SHA256_DIGEST_SIZE; 56f6d5aee88d129 Corentin Labbe 2020-09-18 283 if (digestsize == SHA384_DIGEST_SIZE) 56f6d5aee88d129 Corentin Labbe 2020-09-18 284 digestsize = SHA512_DIGEST_SIZE; 56f6d5aee88d129 Corentin Labbe 2020-09-18 285 56f6d5aee88d129 Corentin Labbe 2020-09-18 286 /* the padding could be up to two block. */ 56f6d5aee88d129 Corentin Labbe 2020-09-18 287 buf = kzalloc(bs * 2, GFP_KERNEL | GFP_DMA); ^ "buf" is leaked as well. 56f6d5aee88d129 Corentin Labbe 2020-09-18 288 if (!buf) 56f6d5aee88d129 Corentin Labbe 2020-09-18 289 return -ENOMEM; 56f6d5aee88d129 Corentin Labbe 2020-09-18 290 bf = (__le32 *)buf; 56f6d5aee88d129 Corentin Labbe 2020-09-18 291 56f6d5aee88d129 Corentin Labbe 2020-09-18 292 result = kzalloc(digestsize, GFP_KERNEL | GFP_DMA); ^ 56f6d5aee88d129 Corentin Labbe 2020-09-18 293 if (!result) 56f6d5aee88d129 Corentin Labbe 2020-09-18 294 return -ENOMEM; 56f6d5aee88d129 Corentin Labbe 2020-09-18 295 56f6d5aee88d129 Corentin Labbe 2020-09-18 296 flow = rctx->flow; 56f6d5aee88d129 Corentin Labbe 2020-09-18 297 chan = >chanlist[flow]; 56f6d5aee88d129 Corentin Labbe 2020-09-18 298 56f6d5aee88d129 Corentin Labbe 2020-09-18 299 #ifdef CONFIG_CRYPTO_DEV_SU
Re: [linux-safety] [PATCH] taskstats: remove unneeded dead assignment
On Fri, Nov 06, 2020 at 12:04:53PM +, Sudip Mukherjee wrote: > Hi Lukas, > > On 06/11/2020 10:31, Lukas Bulwahn wrote: > > > > > > On Fri, 6 Nov 2020, Sudip Mukherjee wrote: > > > >> Hi Lukas, > >> > > > > > > > I did not try but I bet (a beverage of your choice) that the object code > > remains the same also for your suggested patch. Try to disprove my claim > > and possibly earn yourself a beverage when we meet... > > Lets decide which beverage.. ;-) > > Using gcc-7.2.0 for MIPS: > > original:- ab81d3305d578c2568fbc73aad2f9e61 kernel/taskstats.o > After your change:- ab81d3305d578c2568fbc73aad2f9e61 kernel/taskstats.o > After my change:- 0acae2c8d72abd3e15bf805fccdca711 kernel/taskstats.o I'm surprised the line numbers from the printks aren't affecting it... I personally prefer Lukas's patch. "rc" should be function scope... regards, dan carpenter
Re: [MPTCP][PATCH net 1/2] mptcp: fix static checker warnings in mptcp_pm_add_timer
On Mon, Nov 09, 2020 at 05:28:54PM +0100, Matthieu Baerts wrote: > Hi Geliang, Dan, > > On 09/11/2020 14:59, Geliang Tang wrote: > > Fix the following Smatch complaint: > > Thanks for the report and the patch! > > > net/mptcp/pm_netlink.c:213 mptcp_pm_add_timer() > > warn: variable dereferenced before check 'msk' (see line 208) > > > > net/mptcp/pm_netlink.c > > 207 struct mptcp_sock *msk = entry->sock; > > 208 struct sock *sk = (struct sock *)msk; > > 209 struct net *net = sock_net(sk); > > ^^ > > "msk" dereferenced here. > > > > 210 > > 211 pr_debug("msk=%p", msk); > > 212 > > 213 if (!msk) > > > > Too late. > > > > 214 return; > > 215 > > > > Fixes: 93f323b9 ("mptcp: add a new sysctl add_addr_timeout") > > Reported-by: Dan Carpenter > > Signed-off-by: Geliang Tang > > Reviewed-by: Dan Carpenter > > A small detail (I think): the Signed-off-by of the sender (Geliang) should > be the last one in the list if I am not mistaken. > But I guess this is not blocking. Generally, I like them to be in chronological order. For other tags like here it doesn't matter, but for signed-off-bys they only make sense in chronological order. regards, dan carpenter
[tip: locking/urgent] futex: Don't enable IRQs unconditionally in put_pi_state()
The following commit has been merged into the locking/urgent branch of tip: Commit-ID: 1e106aa3509b86738769775969822ffc1ec21bf4 Gitweb: https://git.kernel.org/tip/1e106aa3509b86738769775969822ffc1ec21bf4 Author:Dan Carpenter AuthorDate:Fri, 06 Nov 2020 11:52:05 +03:00 Committer: Thomas Gleixner CommitterDate: Mon, 09 Nov 2020 14:30:30 +01:00 futex: Don't enable IRQs unconditionally in put_pi_state() The exit_pi_state_list() function calls put_pi_state() with IRQs disabled and is not expecting that IRQs will be enabled inside the function. Use the _irqsave() variant so that IRQs are restored to the original state instead of being enabled unconditionally. Fixes: 153fbd1226fb ("futex: Fix more put_pi_state() vs. exit_pi_state_list() races") Signed-off-by: Dan Carpenter Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) Cc: sta...@vger.kernel.org Link: https://lore.kernel.org/r/20201106085205.GA1159983@mwanda --- kernel/futex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index ac32887..00259c7 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -788,8 +788,9 @@ static void put_pi_state(struct futex_pi_state *pi_state) */ if (pi_state->owner) { struct task_struct *owner; + unsigned long flags; - raw_spin_lock_irq(_state->pi_mutex.wait_lock); + raw_spin_lock_irqsave(_state->pi_mutex.wait_lock, flags); owner = pi_state->owner; if (owner) { raw_spin_lock(>pi_lock); @@ -797,7 +798,7 @@ static void put_pi_state(struct futex_pi_state *pi_state) raw_spin_unlock(>pi_lock); } rt_mutex_proxy_unlock(_state->pi_mutex, owner); - raw_spin_unlock_irq(_state->pi_mutex.wait_lock); + raw_spin_unlock_irqrestore(_state->pi_mutex.wait_lock, flags); } if (current->pi_state_cache) {
[kbuild] drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c:1300 create_engine_group() error: we previously assumed 'mirrored_eng_grp' could be null (see line 1256)
Hi SrujanaChalla, First bad commit (maybe != root cause): tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: f8394f232b1eab649ce2df5c5f15b0e528c92091 commit: 6482023b9d3350bf1b756ef36e1ea1a1c871879c crypto: marvell - enable OcteonTX cpt options for build config: x86_64-randconfig-m001-20201109 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/crypto/marvell/octeontx/otx_cptpf_ucode.c:1300 create_engine_group() error: we previously assumed 'mirrored_eng_grp' could be null (see line 1256) vim +/mirrored_eng_grp +1300 drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c d9110b0b01ff1cd SrujanaChalla 2020-03-13 1206 static int create_engine_group(struct device *dev, d9110b0b01ff1cd SrujanaChalla 2020-03-13 1207 struct otx_cpt_eng_grps *eng_grps, d9110b0b01ff1cd SrujanaChalla 2020-03-13 1208 struct otx_cpt_engines *engs, int engs_cnt, d9110b0b01ff1cd SrujanaChalla 2020-03-13 1209 void *ucode_data[], int ucodes_cnt, d9110b0b01ff1cd SrujanaChalla 2020-03-13 1210 bool use_uc_from_tar_arch) d9110b0b01ff1cd SrujanaChalla 2020-03-13 1211 { d9110b0b01ff1cd SrujanaChalla 2020-03-13 1212 struct otx_cpt_eng_grp_info *mirrored_eng_grp; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1213 struct tar_ucode_info_t *tar_info; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1214 struct otx_cpt_eng_grp_info *eng_grp; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1215 int i, ret = 0; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1216 d9110b0b01ff1cd SrujanaChalla 2020-03-13 1217 if (ucodes_cnt > OTX_CPT_MAX_ETYPES_PER_GRP) d9110b0b01ff1cd SrujanaChalla 2020-03-13 1218 return -EINVAL; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1219 d9110b0b01ff1cd SrujanaChalla 2020-03-13 1220 /* Validate if requested engine types are supported by this device */ d9110b0b01ff1cd SrujanaChalla 2020-03-13 1221 for (i = 0; i < engs_cnt; i++) d9110b0b01ff1cd SrujanaChalla 2020-03-13 1222 if (!dev_supports_eng_type(eng_grps, engs[i].type)) { d9110b0b01ff1cd SrujanaChalla 2020-03-13 1223 dev_err(dev, "Device does not support %s engines", d9110b0b01ff1cd SrujanaChalla 2020-03-13 1224 get_eng_type_str(engs[i].type)); d9110b0b01ff1cd SrujanaChalla 2020-03-13 1225 return -EPERM; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1226 } d9110b0b01ff1cd SrujanaChalla 2020-03-13 1227 d9110b0b01ff1cd SrujanaChalla 2020-03-13 1228 /* Find engine group which is not used */ d9110b0b01ff1cd SrujanaChalla 2020-03-13 1229 eng_grp = find_unused_eng_grp(eng_grps); d9110b0b01ff1cd SrujanaChalla 2020-03-13 1230 if (!eng_grp) { d9110b0b01ff1cd SrujanaChalla 2020-03-13 1231 dev_err(dev, "Error all engine groups are being used"); d9110b0b01ff1cd SrujanaChalla 2020-03-13 1232 return -ENOSPC; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1233 } d9110b0b01ff1cd SrujanaChalla 2020-03-13 1234 d9110b0b01ff1cd SrujanaChalla 2020-03-13 1235 /* Load ucode */ d9110b0b01ff1cd SrujanaChalla 2020-03-13 1236 for (i = 0; i < ucodes_cnt; i++) { d9110b0b01ff1cd SrujanaChalla 2020-03-13 1237 if (use_uc_from_tar_arch) { d9110b0b01ff1cd SrujanaChalla 2020-03-13 1238 tar_info = (struct tar_ucode_info_t *) ucode_data[i]; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1239 eng_grp->ucode[i] = tar_info->ucode; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1240 ret = copy_ucode_to_dma_mem(dev, _grp->ucode[i], d9110b0b01ff1cd SrujanaChalla 2020-03-13 1241 tar_info->ucode_ptr); d9110b0b01ff1cd SrujanaChalla 2020-03-13 1242 } else d9110b0b01ff1cd SrujanaChalla 2020-03-13 1243 ret = ucode_load(dev, _grp->ucode[i], d9110b0b01ff1cd SrujanaChalla 2020-03-13 1244 (char *) ucode_data[i]); d9110b0b01ff1cd SrujanaChalla 2020-03-13 1245 if (ret) d9110b0b01ff1cd SrujanaChalla 2020-03-13 1246 goto err_ucode_unload; d9110b0b01ff1cd SrujanaChalla 2020-03-13 1247 } d9110b0b01ff1cd SrujanaChalla 2020-03-13 1248 d9110b0b01ff1cd SrujanaChalla 2020-03-13 1249 /* Validate scenario where 1 ucode is used */ d9110b0b01ff1cd SrujanaChalla 2020-03-13 1250 ret = validate_1_ucode_scenario(dev, eng_grp, engs, engs_cnt); d9110b0b01ff1cd Sru
Re: linux-next: Signed-off-by missing for commit in the nfsd tree
On Sun, Nov 08, 2020 at 04:29:36PM -0500, J. Bruce Fields wrote: > On Mon, Nov 09, 2020 at 08:20:32AM +1100, Stephen Rothwell wrote: > > Hi all, > > > > Commit > > > > bfb5aa1685d5 ("net/sunrpc: fix useless comparison in proc_do_xprt()") > > > > is missing a Signed-off-by from its author. > > I split the original patch in 2 and fixed a bug in this second patch, > but unless I hear otherwise I'll assume Dan's OK with his Signed-off-by > staying on both Yep. Thanks! Signed-off-by: Dan Carpenter regards, dan carpenter
[PATCH] auxdisplay: fix use after free in lcd2s_i2c_remove()
The kfree() needs to be moved down a line to prevent a use after free. Fixes: 8c9108d014c5 ("auxdisplay: add a driver for lcd2s character display") Signed-off-by: Dan Carpenter --- drivers/auxdisplay/lcd2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/auxdisplay/lcd2s.c b/drivers/auxdisplay/lcd2s.c index cfa5f86deeef..3eb7f04db6cb 100644 --- a/drivers/auxdisplay/lcd2s.c +++ b/drivers/auxdisplay/lcd2s.c @@ -348,8 +348,8 @@ static int lcd2s_i2c_remove(struct i2c_client *i2c) { struct lcd2s_data *lcd2s = i2c_get_clientdata(i2c); - kfree(lcd2s->charlcd); charlcd_unregister(lcd2s->charlcd); + kfree(lcd2s->charlcd); return 0; } -- 2.28.0
[PATCH] futex: Don't enable IRQs unconditionally in put_pi_state()
The exit_pi_state_list() function calls put_pi_state() with IRQs disabled and is not expecting that IRQs will be enabled inside the function. Use the _irqsave() so that IRQs are restored to the original state instead of enabled unconditionally. Fixes: 153fbd1226fb ("futex: Fix more put_pi_state() vs. exit_pi_state_list() races") Signed-off-by: Dan Carpenter --- This is from static analysis and not tested. I am not very familiar with futex code. kernel/futex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index f8614ef4ff31..ca84745713bc 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -788,8 +788,9 @@ static void put_pi_state(struct futex_pi_state *pi_state) */ if (pi_state->owner) { struct task_struct *owner; + unsigned long flags; - raw_spin_lock_irq(_state->pi_mutex.wait_lock); + raw_spin_lock_irqsave(_state->pi_mutex.wait_lock, flags); owner = pi_state->owner; if (owner) { raw_spin_lock(>pi_lock); @@ -797,7 +798,7 @@ static void put_pi_state(struct futex_pi_state *pi_state) raw_spin_unlock(>pi_lock); } rt_mutex_proxy_unlock(_state->pi_mutex, owner); - raw_spin_unlock_irq(_state->pi_mutex.wait_lock); + raw_spin_unlock_irqrestore(_state->pi_mutex.wait_lock, flags); } if (current->pi_state_cache) { -- 2.28.0
Re: [PATCH] PCI: fix a potential uninitentional integer overflow issue
On Thu, Nov 05, 2020 at 04:24:30PM -0600, Bjorn Helgaas wrote: > On Wed, Oct 07, 2020 at 03:33:45PM +0300, Dan Carpenter wrote: > > On Wed, Oct 07, 2020 at 12:46:15PM +0100, Colin King wrote: > > > From: Colin Ian King > > > > > > The shift of 1 by align_order is evaluated using 32 bit arithmetic > > > and the result is assigned to a resource_size_t type variable that > > > is a 64 bit unsigned integer on 64 bit platforms. Fix an overflow > > > before widening issue by using the BIT_ULL macro to perform the > > > shift. > > > > > > Addresses-Coverity: ("Uninitentional integer overflow") > > s/Uninitentional/Unintentional/ > Also in subject (please also capitalize subject) > > Doesn't Coverity also assign an ID number for this specific issue? > Can you include that as well, e.g., > > Addresses-Coverity-ID: 1226899 ("Unintentional integer overflow") > > > > Fixes: 07d8d7e57c28 ("PCI: Make specifying PCI devices in kernel > > > parameters reusable") > > > Signed-off-by: Colin Ian King > > > --- > > > drivers/pci/pci.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > > > index 6d4d5a2f923d..1a5844d7af35 100644 > > > --- a/drivers/pci/pci.c > > > +++ b/drivers/pci/pci.c > > > @@ -6209,7 +6209,7 @@ static resource_size_t > > > pci_specified_resource_alignment(struct pci_dev *dev, > > > if (align_order == -1) > > > align = PAGE_SIZE; > > > else > > > - align = 1 << align_order; > > > + align = BIT_ULL(align_order); > > > > "align_order" comes from sscanf() so Smatch thinks it's not trusted. > > Anything above 63 is undefined behavior. There should be a bounds check > > on this but I don't know what the valid values of "align" are. > > The spec doesn't explicitly say what the size limit for 64-bit BARs > is, but it does say 32-bit BARs can support up to 2GB (2^31). So I > infer that 2^63 would be the limit for 64-bit BARs. > > What about something like the following? To me, BIT_ULL doesn't seem > like an advantage over "1ULL << ", but maybe there's a reason to use > it. The advantage of BIT_ULL() is that checkpatch and I think Coccinelle will suggest using it. It's only recently where a few people have complained (actually you're probably the second person) that BIT() is sort of a weird thing to use for size variables. regards, dan carpenter
Re: [v2] media: atomisp: Fix error handling path
On Wed, Nov 04, 2020 at 11:30:29AM +0100, Markus Elfring wrote: > >>> Fixes: 14a638ab96c5 ("media: atomisp: use pin_user_pages() for memory > >>> allocation") > >> > >> Please delete a line break for this tag. > > > > Markus, the thing is that we all saw the line break and we just thought > > it didn't matter at all... > > Do you disagree to the known documentation then? > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=4ef8451b332662d004df269d4cdeb7d9f31419b5#n123 > The documentation is correct but no one wants you to constantly be nagging developers about minor stuff... One thing that I do is I start to write an email and then if I realize it's not worth complaining about and I save it to my postponed messages folder. Then I never send it and I forget about it completely. I have currently have 740 messages in my postponed messages folder. :P That's a lot of whining and complaining which I never sent and the world is the more beautiful for it. regards, dan carpenter
Re: [PATCH v2] media: atomisp: Fix error handling path
On Wed, Nov 04, 2020 at 08:15:58AM +0100, Markus Elfring wrote: > > Fixes: 14a638ab96c5 ("media: atomisp: use pin_user_pages() for memory > > allocation") > > Please delete a line break for this tag. Markus, the thing is that we all saw the line break and we just thought it didn't matter at all... regards, dan carpenter
[kbuild] Re: [PATCH] sound/core/seq: remove dead code
Hi Yu, url: https://github.com/0day-ci/linux/commits/Yu-Hao/sound-core-seq-remove-dead-code/20201102-152326 base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next compiler: sparc64-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) >> sound/core/seq/seq_queue.c:545:16: warning: Unused variable: flags >> [unusedVariable] unsigned long flags; ^ vim +545 sound/core/seq/seq_queue.c ^1da177e4c3f415 Linus Torvalds 2005-04-16 543 void snd_seq_queue_client_termination(int client) ^1da177e4c3f415 Linus Torvalds 2005-04-16 544 { ^1da177e4c3f415 Linus Torvalds 2005-04-16 @545 unsigned long flags; ^^^ Unused. ^1da177e4c3f415 Linus Torvalds 2005-04-16 546 int i; c7e0b5bf9fff1b7 Takashi Iwai 2005-11-17 547 struct snd_seq_queue *q; ^1da177e4c3f415 Linus Torvalds 2005-04-16 548 ^1da177e4c3f415 Linus Torvalds 2005-04-16 549 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { ^1da177e4c3f415 Linus Torvalds 2005-04-16 550 if ((q = queueptr(i)) == NULL) ^1da177e4c3f415 Linus Torvalds 2005-04-16 551 continue; ^1da177e4c3f415 Linus Torvalds 2005-04-16 552 queuefree(q); ^1da177e4c3f415 Linus Torvalds 2005-04-16 553 } ^1da177e4c3f415 Linus Torvalds 2005-04-16 554 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org ___ kbuild mailing list -- kbu...@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
[kbuild] sound/soc/codecs/wcd934x.c:1571:9: warning: Identical condition 'ret', second condition is always false
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: b7cbaf59f62f8ab8f157698f9e31642bff525bd0 commit: bbd7ffdbef6888459f301c5889f3b14ada38b913 clk: Allow the common clk framework to be selectable compiler: ia64-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) >> sound/soc/codecs/wcd934x.c:1571:9: warning: Identical condition 'ret', >> second condition is always false [identicalConditionAfterEarlyExit] return ret; ^ sound/soc/codecs/wcd934x.c:1568:6: note: first condition if (ret) ^ sound/soc/codecs/wcd934x.c:1571:9: note: second condition return ret; ^ vim +/ret +1571 sound/soc/codecs/wcd934x.c a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1561 a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1562ret = wcd934x_set_prim_interpolator_rate(dai, (u8)rate_val, a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1563 sample_rate); a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1564if (ret) a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1565return ret; a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1566ret = wcd934x_set_mix_interpolator_rate(dai, (u8)rate_val, a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1567 sample_rate); a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1568if (ret) a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1569return ret; a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1570 a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 @1571return ret; ^^^ Just "return 0;" a61f3b4f476eceb Srinivas Kandagatla 2019-12-19 1572 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org ___ kbuild mailing list -- kbu...@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
drivers/net/wireless/ath/ath10k/mac.c:9125 ath10k_mac_op_set_tid_config() error: uninitialized symbol 'ret'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 3cea11cd5e3b00d91caf0b4730194039b45c5891 commit: 7b2531d93bac6bea67e9c7f49901e9e8796d6d57 ath10k: Add new api to support TID specific configuration config: x86_64-randconfig-m031-20201102 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/wireless/ath/ath10k/mac.c:9125 ath10k_mac_op_set_tid_config() error: uninitialized symbol 'ret'. vim +/ret +9125 drivers/net/wireless/ath/ath10k/mac.c 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9089 static int ath10k_mac_op_set_tid_config(struct ieee80211_hw *hw, 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9090 struct ieee80211_vif *vif, 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9091 struct ieee80211_sta *sta, 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9092 struct cfg80211_tid_config *tid_config) 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9093 { 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9094struct ath10k *ar = hw->priv; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9095struct ath10k_vif *arvif = (void *)vif->drv_priv; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9096struct ath10k_mac_iter_tid_conf_data data = {}; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9097struct wmi_per_peer_per_tid_cfg_arg arg = {}; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9098int ret, i; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9099 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9100 mutex_lock(>conf_mutex); 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9101arg.vdev_id = arvif->vdev_id; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9102 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9103 memset(arvif->tid_conf_changed, 0, sizeof(arvif->tid_conf_changed)); 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9104 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9105for (i = 0; i < tid_config->n_tid_conf; i++) { 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9106ret = ath10k_mac_parse_tid_config(ar, sta, vif, 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9107 _config->tid_conf[i], 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9108 ); 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9109if (ret) 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9110goto exit; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9111} 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9112 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9113if (sta) 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9114goto exit; ^^ 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9115 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9116ret = 0; Probably just move this to the "int ret = 0;" start of the function? 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9117data.curr_vif = vif; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9118data.ar = ar; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9119 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9120 ieee80211_iterate_stations_atomic(hw, ath10k_mac_vif_stations_tid_conf, 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9121 ); 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9122 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9123 exit: 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9124 mutex_unlock(>conf_mutex); 7b2531d93bac6be Tamizh Chelvam 2020-08-19 @9125return ret; 7b2531d93bac6be Tamizh Chelvam 2020-08-19 9126 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[kbuild] Re: [PATCH] drm/irq: Add irq as false detection
Hi Tian, url: https://github.com/0day-ci/linux/commits/Tian-Tao/drm-irq-Add-irq-as-false-detection/20201102-192137 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 3cea11cd5e3b00d91caf0b4730194039b45c5891 config: x86_64-randconfig-m001-20201102 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/drm_irq.c:175 drm_irq_uninstall() warn: variable dereferenced before check 'dev' (see line 175) Old smatch warnings: drivers/gpu/drm/drm_irq.c:149 drm_irq_install() warn: 'irq' not released on lines: 133. vim +/dev +175 drivers/gpu/drm/drm_irq.c 84b1fd103dbbe01 drivers/char/drm/drm_irq.c Dave Airlie2007-07-11 169 int drm_irq_uninstall(struct drm_device *dev) ^1da177e4c3f415 drivers/char/drm/drm_irq.c Linus Torvalds 2005-04-16 170 { dc1336ff4fe08ae drivers/gpu/drm/drm_irq.c Jesse Barnes 2009-01-06 171 unsigned long irqflags; 4423843cde65232 drivers/gpu/drm/drm_irq.c Ville Syrjälä 2013-10-04 172 bool irq_enabled; 4423843cde65232 drivers/gpu/drm/drm_irq.c Ville Syrjälä 2013-10-04 173 int i; ^1da177e4c3f415 drivers/char/drm/drm_irq.c Linus Torvalds 2005-04-16 174 fa889e8baa5377b drivers/gpu/drm/drm_irq.c Tian Tao 2020-11-02 @175 if (!dev->irq_enabled || !dev) ^^ This is checking "dev" after dereferencing it. Can "dev" even be NULL? fa889e8baa5377b drivers/gpu/drm/drm_irq.c Tian Tao 2020-11-02 176 return 0; fa889e8baa5377b drivers/gpu/drm/drm_irq.c Tian Tao 2020-11-02 177 ^1da177e4c3f415 drivers/char/drm/drm_irq.c Linus Torvalds 2005-04-16 178 irq_enabled = dev->irq_enabled; 4423843cde65232 drivers/gpu/drm/drm_irq.c Ville Syrjälä 2013-10-04 179 dev->irq_enabled = false; ^1da177e4c3f415 drivers/char/drm/drm_irq.c Linus Torvalds 2005-04-16 180 dc1336ff4fe08ae drivers/gpu/drm/drm_irq.c Jesse Barnes 2009-01-06 181 /* 3bff93d64cf59f0 drivers/gpu/drm/drm_irq.c Daniel Vetter 2015-02-22 182 * Wake up any waiters so they don't hang. This is just to paper over --- 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 -- kbu...@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
[kbuild] Re: [PATCH v11 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile
Hi Konstantin, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.10-rc2 next-20201030] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch ] url: https://github.com/0day-ci/linux/commits/Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20201031-220904 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5fc6b075e165f641fbc366b58b578055762d5f8c config: i386-randconfig-m021-20201101 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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: fs/ntfs3/attrib.c:331 attr_set_size_res() error: dereferencing freed memory 'attr_s' fs/ntfs3/attrib.c:1267 attr_allocate_frame() error: uninitialized symbol 'hint'. fs/ntfs3/attrib.c:1393 attr_allocate_frame() error: we previously assumed 'attr_b' could be null (see line 1306) fs/ntfs3/namei.c:438 ntfs_rename() warn: variable dereferenced before check 'old_inode' (see line 296) fs/ntfs3/fsntfs.c:844 ntfs_clear_mft_tail() error: uninitialized symbol 'err'. fs/ntfs3/fsntfs.c:1294 ntfs_read_run_nb() error: uninitialized symbol 'idx'. fs/ntfs3/frecord.c:166 ni_load_mi_ex() error: we previously assumed 'r' could be null (see line 159) fs/ntfs3/frecord.c:505 ni_ins_new_attr() error: we previously assumed 'le' could be null (see line 490) fs/ntfs3/frecord.c:658 ni_repack() warn: 'run.runs_' double freed fs/ntfs3/frecord.c:1439 ni_insert_nonresident() warn: potential memory corrupting cast 8 vs 2 bytes fs/ntfs3/frecord.c:2214 ni_read_frame() warn: ignoring unreachable code. fs/ntfs3/xattr.c:514 ntfs_get_acl_ex() warn: passing zero to 'ERR_PTR' fs/ntfs3/index.c:1133 indx_find() warn: variable dereferenced before check 'fnd' (see line 1117) fs/ntfs3/index.c:1371 indx_find_raw() error: we previously assumed 'n' could be null (see line 1349) fs/ntfs3/index.c:1404 indx_create_allocate() warn: should '1 << indx->index_bits' be a 64 bit type? fs/ntfs3/index.c:1755 indx_insert_into_root() warn: possible memory leak of 're' fs/ntfs3/index.c:549 hdr_find_split() warn: variable dereferenced before check 'e' (see line 547) fs/ntfs3/inode.c:687 ntfs_readpage() warn: should 'page->index << 12' be a 64 bit type? fs/ntfs3/fslog.c:2205 last_log_lsn() warn: possible memory leak of 'page_bufs' fs/ntfs3/fslog.c:2418 find_log_rec() error: we previously assumed 'rh' could be null (see line 2404) fs/ntfs3/fslog.c:2551 find_client_next_lsn() error: double free of 'lcb->lrh' fs/ntfs3/fslog.c:639 enum_rstbl() error: we previously assumed 't' could be null (see line 628) fs/ntfs3/fslog.c:3158 do_action() warn: variable dereferenced before check 'mi' (see line 3118) fs/ntfs3/fslog.c:3913 log_replay() error: dereferencing freed memory 'rst_info.r_page' vim +/attr_s +331 fs/ntfs3/attrib.c e3a1cdcc648083 Konstantin Komarov 2020-10-30 241 static int attr_set_size_res(struct ntfs_inode *ni, struct ATTRIB *attr, e3a1cdcc648083 Konstantin Komarov 2020-10-30 242 struct ATTR_LIST_ENTRY *le, struct mft_inode *mi, e3a1cdcc648083 Konstantin Komarov 2020-10-30 243 u64 new_size, struct runs_tree *run, e3a1cdcc648083 Konstantin Komarov 2020-10-30 244 struct ATTRIB **ins_attr) e3a1cdcc648083 Konstantin Komarov 2020-10-30 245 { e3a1cdcc648083 Konstantin Komarov 2020-10-30 246 int err = 0; e3a1cdcc648083 Konstantin Komarov 2020-10-30 247 struct ntfs_sb_info *sbi = mi->sbi; e3a1cdcc648083 Konstantin Komarov 2020-10-30 248 struct MFT_REC *rec = mi->mrec; e3a1cdcc648083 Konstantin Komarov 2020-10-30 249 u32 used = le32_to_cpu(rec->used); e3a1cdcc648083 Konstantin Komarov 2020-10-30 250 u32 asize = le32_to_cpu(attr->size); e3a1cdcc648083 Konstantin Komarov 2020-10-30 251 u32 aoff = PtrOffset(rec, attr); e3a1cdcc648083 Konstantin Komarov 2020-10-30 252 u32 rsize = le32_to_cpu(attr->res.data_size); e3a1cdcc648083 Konstantin Komarov 2020-10-30 253 u32 tail = used - aoff - asize; e3a1cdcc648083 Konstantin Komarov 2020-10-30 254 char *next = Add2Ptr(attr, asize); e3a1cdcc648083 Konstantin Komarov 2020-10-30 255 int dsize = QuadAlign(new_size) - QuadAlign(rsize); e3a1cdcc648083 Konstantin Komarov 2020-10-30 256 CLST len, alen; e3a1cdcc648083 Konstantin Komarov 2020-10-30 257 struct ATTRIB *attr_s = NULL; e3a1cdcc648083 Konstantin Komarov 2020-10-30 258 bool is_ext; e3a1cdcc648083 Konstantin Komarov 2020-10-30 259 e3a1cdcc648083 Konstantin Komarov 2020-10-30 260 if (dsize < 0) { e3a1cdcc648083 Konstantin Komarov 2020-10-30 261 memmove(next + dsize,
[PATCH] ide: Prevent some negative shifts in ide_set_ignore_cable()
Shifting by a negative number is undefined. These values come from the module parameter, so it's not a big deal from a practical perspective. Fixes: 9fd91d959f1a ("ide: add "ignore_cable" parameter (take 2)") Signed-off-by: Dan Carpenter --- drivers/ide/ide.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 9a9c64fd1032..dcfb8a187c46 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -338,7 +338,7 @@ static int ide_set_ignore_cable(const char *s, const struct kernel_param *kp) if (sscanf(s, "%d:%d", , ) != 2 && sscanf(s, "%d", ) != 1) return -EINVAL; - if (i >= MAX_HWIFS || j < 0 || j > 1) + if (i < 0 || i >= MAX_HWIFS || j < 0 || j > 1) return -EINVAL; if (j) -- 2.28.0
drivers/net/wireless/intel/iwlwifi/pcie/drv.c:1049 iwl_pci_probe() warn: mask and shift to zero
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: ed8780e3f2ecc82645342d070c6b4e530532e680 commit: d6f2134a383168bfb28ac458f7e4311e58482439 iwlwifi: add mac/rf types and 160MHz to the device tables config: parisc-randconfig-m031-20201028 (attached as .config) compiler: hppa64-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 New smatch warnings: drivers/net/wireless/intel/iwlwifi/pcie/drv.c:1049 iwl_pci_probe() warn: mask and shift to zero vim +1049 drivers/net/wireless/intel/iwlwifi/pcie/drv.c d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1034 2a612a60ab440e6 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1035for (i = 0; i < ARRAY_SIZE(iwl_dev_info_table); i++) { 2a612a60ab440e6 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1036const struct iwl_dev_info *dev_info = _dev_info_table[i]; d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1037if ((dev_info->device == (u16)IWL_CFG_ANY || 2a612a60ab440e6 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1038 dev_info->device == pdev->device) && d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1039(dev_info->subdevice == (u16)IWL_CFG_ANY || d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1040 dev_info->subdevice == pdev->subsystem_device) && d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1041(dev_info->mac_type == (u16)IWL_CFG_ANY || d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1042 dev_info->mac_type == d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1043 CSR_HW_REV_TYPE(iwl_trans->hw_rev)) && d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1044(dev_info->rf_type == (u16)IWL_CFG_ANY || d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1045 dev_info->rf_type == d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1046 CSR_HW_RFID_TYPE(iwl_trans->hw_rf_id)) && d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1047(dev_info->no_160 == (u8)IWL_CFG_ANY || d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 1048 dev_info->no_160 == d6f2134a383168b drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2020-03-09 @1049 IWL_SUBDEVICE_NO_160(pdev->subsystem_device))) { The IWL_SUBDEVICE_NO_160() is: #define IWL_SUBDEVICE_NO_160(subdevice) ((u16)((subdevice) & 0x0100) >> 9 And 0x100 >> 9 is zero. Probably either the mask or the shift is has a typo. 2a612a60ab440e6 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1050iwl_trans->cfg = dev_info->cfg; 0b295a1eb81f37d drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1051iwl_trans->name = dev_info->name; 2a612a60ab440e6 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1052goto found; 2a612a60ab440e6 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-10-10 1053} 7d34a7d7da97bc8 drivers/net/wireless/intel/iwlwifi/pcie/drv.c Luca Coelho 2019-07-12 1054} --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [RFC] wimax: move out to staging
On Tue, Oct 27, 2020 at 10:20:13PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > There are no known users of this driver as of October 2020, and it will > be removed unless someone turns out to still need it in future releases. > > According to https://en.wikipedia.org/wiki/List_of_WiMAX_networks, there > have been many public wimax networks, but it appears that these entries > are all stale, after everyone has migrated to LTE or discontinued their > service altogether. Wimax is still pretty common in Africa. But you have to buy an outdoor antenae with all the software on it and an ethernet cable into your house. I don't know what software the antennaes are using. Probably Linux but with an out of tree kernel module is my guess. regards, dan carpenter
[kbuild] drivers/gpu/drm/amd/amdkfd/kfd_crat.c:801:9: warning: Either the condition '!pcrat_image' is redundant or there is possible null pointer dereference: pcrat_image.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4525c8781ec0701ce824e8bd379ae1b129e26568 commit: d0e63b343e575e8b74c185565b0d79a93494bcaa drm/amdkfd: Use kvmalloc instead of kmalloc for VCRAT compiler: powerpc64le-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) In file included from drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_crat.c: >> drivers/gpu/drm/amd/amdkfd/kfd_crat.c:801:9: warning: Either the condition >> '!pcrat_image' is redundant or there is possible null pointer dereference: >> pcrat_image. [nullPointerRedundantCheck] memcpy(pcrat_image, crat_table, crat_table->length); ^ drivers/gpu/drm/amd/amdkfd/kfd_crat.c:802:6: note: Assuming that condition '!pcrat_image' is not redundant if (!pcrat_image) ^ drivers/gpu/drm/amd/amdkfd/kfd_crat.c:801:9: note: Null pointer dereference memcpy(pcrat_image, crat_table, crat_table->length); ^ drivers/gpu/drm/amd/amdkfd/kfd_crat.c:405:32: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned] if (props && (iolink->flags & CRAT_IOLINK_FLAGS_BI_DIRECTIONAL)) { ^ drivers/gpu/drm/amd/amdkfd/kfd_crat.c:1112:26: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned] sub_type_hdr->flags |= CRAT_IOLINK_FLAGS_BI_DIRECTIONAL; ^ drivers/gpu/drm/amd/amdkfd/kfd_crat.c:1146:11: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned] CRAT_IOLINK_FLAGS_BI_DIRECTIONAL; ^ drivers/gpu/drm/amd/amdkfd/kfd_crat.c:941:3: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg] sub_type_hdr++; ^ vim +801 drivers/gpu/drm/amd/amdkfd/kfd_crat.c 8e05247d4c23ff1 Harish Kasiviswanathan 2017-12-08 772 int kfd_create_crat_image_acpi(void **crat_image, size_t *size) 174de876d6d02f7 Felix Kuehling 2017-12-08 773 { 174de876d6d02f7 Felix Kuehling 2017-12-08 774 struct acpi_table_header *crat_table; 174de876d6d02f7 Felix Kuehling 2017-12-08 775 acpi_status status; 8e05247d4c23ff1 Harish Kasiviswanathan 2017-12-08 776 void *pcrat_image; 174de876d6d02f7 Felix Kuehling 2017-12-08 777 8e05247d4c23ff1 Harish Kasiviswanathan 2017-12-08 778 if (!crat_image) 174de876d6d02f7 Felix Kuehling 2017-12-08 779 return -EINVAL; 174de876d6d02f7 Felix Kuehling 2017-12-08 780 8e05247d4c23ff1 Harish Kasiviswanathan 2017-12-08 781 *crat_image = NULL; 8e05247d4c23ff1 Harish Kasiviswanathan 2017-12-08 782 8e05247d4c23ff1 Harish Kasiviswanathan 2017-12-08 783 /* Fetch the CRAT table from ACPI */ 174de876d6d02f7 Felix Kuehling 2017-12-08 784 status = acpi_get_table(CRAT_SIGNATURE, 0, _table); 174de876d6d02f7 Felix Kuehling 2017-12-08 785 if (status == AE_NOT_FOUND) { 174de876d6d02f7 Felix Kuehling 2017-12-08 786 pr_warn("CRAT table not found\n"); 174de876d6d02f7 Felix Kuehling 2017-12-08 787 return -ENODATA; 174de876d6d02f7 Felix Kuehling 2017-12-08 788 } else if (ACPI_FAILURE(status)) { 174de876d6d02f7 Felix Kuehling 2017-12-08 789 const char *err = acpi_format_exception(status); 174de876d6d02f7 Felix Kuehling 2017-12-08 790 174de876d6d02f7 Felix Kuehling 2017-12-08 791 pr_err("CRAT table error: %s\n", err); 174de876d6d02f7 Felix Kuehling 2017-12-08 792 return -EINVAL; 174de876d6d02f7 Felix Kuehling 2017-12-08 793 } 174de876d6d02f7 Felix Kuehling 2017-12-08 794 6127896f4a27257 Huang Rui 2020-08-18 795 if (kfd_ignore_crat()) { ebcfd1e276207e4 Felix Kuehling 2017-12-08 796 pr_info("CRAT table disabled by module option\n"); ebcfd1e276207e4 Felix Kuehling 2017-12-08 797 return -ENODATA; ebcfd1e276207e4 Felix Kuehling 2017-12-08 798 } ebcfd1e276207e4 Felix Kuehling 2017-12-08 799 d0e63b343e575e8 Kent Russell 2020-09-18 800 pcrat_image = kvmalloc(crat_table->length, GFP_KERNEL); d0e63b343e575e8 Kent Russell 2020-09-18 @801 memcpy(pcrat_image, crat_table, crat_table->length); ^^^ Dereferenced before the check for NULL 8e05247d4c23ff1 Harish Kasiviswanathan 2017-12-08 802 if (!pcrat_image)
[kbuild] drivers/gpu/drm/aspeed/aspeed_gfx_drv.c:80:9: warning: Identical condition 'ret', second condition is always false
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4525c8781ec0701ce824e8bd379ae1b129e26568 commit: c2c25c1cf96927a0b6ddb6aaa063f1fdcc90d749 drm/aspeed: Use managed drmm_mode_config_cleanup compiler: nds32le-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/gpu/drm/aspeed/aspeed_gfx_drv.c:80:9: warning: Identical condition >> 'ret', second condition is always false [identicalConditionAfterEarlyExit] return ret; ^ drivers/gpu/drm/aspeed/aspeed_gfx_drv.c:71:6: note: first condition if (ret) ^ drivers/gpu/drm/aspeed/aspeed_gfx_drv.c:80:9: note: second condition return ret; ^ vim +/ret +80 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c c2c25c1cf96927a Daniel Vetter 2020-09-04 66 static int aspeed_gfx_setup_mode_config(struct drm_device *drm) 4f2a8f5898ecd80 Joel Stanley 2019-04-03 67 { c2c25c1cf96927a Daniel Vetter 2020-09-04 68int ret; c2c25c1cf96927a Daniel Vetter 2020-09-04 69 c2c25c1cf96927a Daniel Vetter 2020-09-04 70ret = drmm_mode_config_init(drm); c2c25c1cf96927a Daniel Vetter 2020-09-04 71if (ret) c2c25c1cf96927a Daniel Vetter 2020-09-04 72return ret; 4f2a8f5898ecd80 Joel Stanley 2019-04-03 73 4f2a8f5898ecd80 Joel Stanley 2019-04-03 74drm->mode_config.min_width = 0; 4f2a8f5898ecd80 Joel Stanley 2019-04-03 75drm->mode_config.min_height = 0; 4f2a8f5898ecd80 Joel Stanley 2019-04-03 76drm->mode_config.max_width = 800; 4f2a8f5898ecd80 Joel Stanley 2019-04-03 77drm->mode_config.max_height = 600; 4f2a8f5898ecd80 Joel Stanley 2019-04-03 78drm->mode_config.funcs = _gfx_mode_config_funcs; c2c25c1cf96927a Daniel Vetter 2020-09-04 79 c2c25c1cf96927a Daniel Vetter 2020-09-04 @80return ret; This should just be "return 0;" 4f2a8f5898ecd80 Joel Stanley 2019-04-03 81 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org ___ kbuild mailing list -- kbu...@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
Re: [PATCH] staging: rtl8192e, rtl8192u: use correct notation to define pointer
On Tue, Oct 27, 2020 at 12:23:03PM +0100, Greg KH wrote: > On Mon, Oct 26, 2020 at 05:14:35PM +0500, Muhammad Usama Anjum wrote: > > Use pointer notation instead of using array notation as info_element is > > a pointer not array. > > > > Warnings from sparse: > > drivers/staging/rtl8192u/ieee80211/ieee80211.h:1013:51: warning: array of > > flexible structures > > drivers/staging/rtl8192u/ieee80211/ieee80211.h:985:51: warning: array of > > flexible structures > > drivers/staging/rtl8192u/ieee80211/ieee80211.h:963:51: warning: array of > > flexible structures > > drivers/staging/rtl8192u/ieee80211/ieee80211.h:996:51: warning: array of > > flexible structures > > drivers/staging/rtl8192u/ieee80211/ieee80211.h:974:51: warning: array of > > flexible structures > > > > drivers/staging/rtl8192e/rtllib.h:832:48: warning: array of flexible > > structures > > drivers/staging/rtl8192e/rtllib.h:851:48: warning: array of flexible > > structures > > drivers/staging/rtl8192e/rtllib.h:805:48: warning: array of flexible > > structures > > drivers/staging/rtl8192e/rtllib.h:843:48: warning: array of flexible > > structures > > drivers/staging/rtl8192e/rtllib.h:821:48: warning: array of flexible > > structures > > > > Signed-off-by: Muhammad Usama Anjum > > --- > > drivers/staging/rtl8192e/rtllib.h | 10 +- > > drivers/staging/rtl8192u/ieee80211/ieee80211.h | 12 ++-- > > 2 files changed, 11 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/staging/rtl8192e/rtllib.h > > b/drivers/staging/rtl8192e/rtllib.h > > index b84f00b8d18b..1dab9c3d08a8 100644 > > --- a/drivers/staging/rtl8192e/rtllib.h > > +++ b/drivers/staging/rtl8192e/rtllib.h > > @@ -802,7 +802,7 @@ struct rtllib_authentication { > > __le16 transaction; > > __le16 status; > > /*challenge*/ > > - struct rtllib_info_element info_element[]; > > + struct rtllib_info_element *info_element; > > } __packed; > > Are you sure these changes are correct? This isn't just a list of > structures after this at the end of the structure? Definitely the patch will break things at runtime. I was surprised that it compiles, but it does. > > Please look at commit 5979afa2c4d1 ("staging: Replace zero-length array > with flexible-array member") which made most of these flexible arrays. > > This is not a pointer, it really is an array, I think sparse is really > wrong here, be careful. It's an interesting warning message. Sparse is correct that the code looks strange. If there were ever two or more elements in the array then the code would break. But since the code only uses a max of one element then it's fine. I guess the question is does this warning ever catch bugs in real life? It seems like that the kind of bug which would be caught in testing so static analysis is not going to be useful. regards, dan carpenter
drivers/tty/serial/owl-uart.c:712 owl_uart_probe() warn: 'owl_port->clk' not released on lines: 698.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 7cf726a59435301046250c42131554d9ccc566b8 commit: abf42d2f333b21bf8d33b2fbb8a85fa62037ac01 tty: serial: owl: add "much needed" clk_prepare_enable() config: ia64-randconfig-m031-20201019 (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/tty/serial/owl-uart.c:712 owl_uart_probe() warn: 'owl_port->clk' not released on lines: 698. vim +712 drivers/tty/serial/owl-uart.c fc60a8b675bd949 Andreas Färber 2017-07-09 638 static int owl_uart_probe(struct platform_device *pdev) fc60a8b675bd949 Andreas Färber 2017-07-09 639 { fc60a8b675bd949 Andreas Färber 2017-07-09 640const struct of_device_id *match; fc60a8b675bd949 Andreas Färber 2017-07-09 641const struct owl_uart_info *info = NULL; fc60a8b675bd949 Andreas Färber 2017-07-09 642struct resource *res_mem; fc60a8b675bd949 Andreas Färber 2017-07-09 643struct owl_uart_port *owl_port; fc60a8b675bd949 Andreas Färber 2017-07-09 644int ret, irq; fc60a8b675bd949 Andreas Färber 2017-07-09 645 fc60a8b675bd949 Andreas Färber 2017-07-09 646if (pdev->dev.of_node) { fc60a8b675bd949 Andreas Färber 2017-07-09 647pdev->id = of_alias_get_id(pdev->dev.of_node, "serial"); fc60a8b675bd949 Andreas Färber 2017-07-09 648match = of_match_node(owl_uart_dt_matches, pdev->dev.of_node); fc60a8b675bd949 Andreas Färber 2017-07-09 649if (match) fc60a8b675bd949 Andreas Färber 2017-07-09 650info = match->data; fc60a8b675bd949 Andreas Färber 2017-07-09 651} fc60a8b675bd949 Andreas Färber 2017-07-09 652 fc60a8b675bd949 Andreas Färber 2017-07-09 653if (pdev->id < 0 || pdev->id >= OWL_UART_PORT_NUM) { fc60a8b675bd949 Andreas Färber 2017-07-09 654 dev_err(>dev, "id %d out of range\n", pdev->id); fc60a8b675bd949 Andreas Färber 2017-07-09 655return -EINVAL; fc60a8b675bd949 Andreas Färber 2017-07-09 656} fc60a8b675bd949 Andreas Färber 2017-07-09 657 fc60a8b675bd949 Andreas Färber 2017-07-09 658res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); fc60a8b675bd949 Andreas Färber 2017-07-09 659if (!res_mem) { fc60a8b675bd949 Andreas Färber 2017-07-09 660 dev_err(>dev, "could not get mem\n"); fc60a8b675bd949 Andreas Färber 2017-07-09 661return -ENODEV; fc60a8b675bd949 Andreas Färber 2017-07-09 662} fc60a8b675bd949 Andreas Färber 2017-07-09 663 fc60a8b675bd949 Andreas Färber 2017-07-09 664irq = platform_get_irq(pdev, 0); 1df217868178bde Stephen Boyd 2019-07-30 665if (irq < 0) fc60a8b675bd949 Andreas Färber 2017-07-09 666return irq; fc60a8b675bd949 Andreas Färber 2017-07-09 667 fc60a8b675bd949 Andreas Färber 2017-07-09 668if (owl_uart_ports[pdev->id]) { fc60a8b675bd949 Andreas Färber 2017-07-09 669 dev_err(>dev, "port %d already allocated\n", pdev->id); fc60a8b675bd949 Andreas Färber 2017-07-09 670return -EBUSY; fc60a8b675bd949 Andreas Färber 2017-07-09 671} fc60a8b675bd949 Andreas Färber 2017-07-09 672 fc60a8b675bd949 Andreas Färber 2017-07-09 673owl_port = devm_kzalloc(>dev, sizeof(*owl_port), GFP_KERNEL); fc60a8b675bd949 Andreas Färber 2017-07-09 674if (!owl_port) fc60a8b675bd949 Andreas Färber 2017-07-09 675return -ENOMEM; fc60a8b675bd949 Andreas Färber 2017-07-09 676 fc60a8b675bd949 Andreas Färber 2017-07-09 677owl_port->clk = devm_clk_get(>dev, NULL); fc60a8b675bd949 Andreas Färber 2017-07-09 678if (IS_ERR(owl_port->clk)) { fc60a8b675bd949 Andreas Färber 2017-07-09 679 dev_err(>dev, "could not get clk\n"); fc60a8b675bd949 Andreas Färber 2017-07-09 680return PTR_ERR(owl_port->clk); fc60a8b675bd949 Andreas Färber 2017-07-09 681} fc60a8b675bd949 Andreas Färber 2017-07-09 682 abf42d2f333b21b Amit Singh Tomar 2020-04-17 683ret = clk_prepare_enable(owl_port->clk); New clk_prepare_enable(). abf42d2f333b21b Amit Singh Tomar 2020-04-17 684if (ret) { abf42d2f333b21b Amit Singh Tomar 2020-04-17 685 dev_err(>dev, "could not enable clk\n"); abf42d2f333b21b Amit Singh Tomar 2020-04-17 686return ret; abf42d2f333b21b Amit Singh Tomar 2020-04-17 687} abf42d2f333b21b Amit Singh Tomar 2020-04-17 688 fc60a8b675bd949 Andreas Färber 2017-07-09 689owl_port->port.dev = >dev; fc60a8b675bd9
drivers/usb/typec/tcpm/tcpci_maxim.c:324 max_tcpci_irq() error: uninitialized symbol 'irq_return'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 9ff9b0d392ea08090cd1780fb196f36dbb586529 commit: 6f413b559f86a2894188e082e389ff95ee428345 usb: typec: tcpci_maxim: Chip level TCPC driver config: nios2-randconfig-m031-20201016 (attached as .config) compiler: nios2-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 New smatch warnings: drivers/usb/typec/tcpm/tcpci_maxim.c:324 max_tcpci_irq() error: uninitialized symbol 'irq_return'. drivers/usb/typec/tcpm/tcpci_maxim.c:407 max_tcpci_probe() warn: passing zero to 'PTR_ERR' Old smatch warnings: drivers/usb/typec/tcpm/tcpci_maxim.c:408 max_tcpci_probe() warn: passing zero to 'PTR_ERR' vim +/irq_return +324 drivers/usb/typec/tcpm/tcpci_maxim.c 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 301 static irqreturn_t max_tcpci_irq(int irq, void *dev_id) 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 302 { 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 303 struct max_tcpci_chip *chip = dev_id; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 304 u16 status; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 305 irqreturn_t irq_return; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 306 int ret; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 307 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 308 if (!chip->port) 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 309 return IRQ_HANDLED; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 310 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 311 ret = max_tcpci_read16(chip, TCPC_ALERT, ); Can status be zero? If it is then then "irq_return" is uninitialized. 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 312 if (ret < 0) { 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 313 dev_err(chip->dev, "ALERT read failed\n"); 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 314 return ret; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 315 } 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 316 while (status) { 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 317 irq_return = _max_tcpci_irq(chip, status); 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 318 /* Do not return if the ALERT is already set. */ 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 319 ret = max_tcpci_read16(chip, TCPC_ALERT, ); 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 320 if (ret < 0) 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 321 break; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 322 } 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 323 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 @324 return irq_return; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 325 } 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 326 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 327 static irqreturn_t max_tcpci_isr(int irq, void *dev_id) 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 328 { 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 329 struct max_tcpci_chip *chip = dev_id; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 330 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 331 pm_wakeup_event(chip->dev, PD_ACTIVITY_TIMEOUT_MS); 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 332 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 333 if (!chip->port) 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 334 return IRQ_HANDLED; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 335 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 336 return IRQ_WAKE_THREAD; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 337 } 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 338 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 339 static int max_tcpci_init_alert(struct max_tcpci_chip *chip, struct i2c_client *client) 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 340 { 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 341 int ret; 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 342 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 343 ret = devm_request_threaded_irq(chip->dev, client->irq, max_tcpci_isr, max_tcpci_irq, 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 344 (IRQF_TRIGGER_LOW | IRQF_ONESHOT), dev_name(chip->dev), 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 345 chip); 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 346 6f413b559f86a28 Badhri Jagan Sridharan 2020-10-07 347 if (ret < 0) 6f413b559f86a28 Badhri Jagan
[kbuild] drivers/bus/mhi/core/boot.c:222:3: warning: Variable 'i' is modified but its new value is never used.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4525c8781ec0701ce824e8bd379ae1b129e26568 commit: cd457afb16670501f00354eb0e705a7d8a50d79d bus: mhi: core: Add support for downloading firmware over BHIe compiler: powerpc64le-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/bus/mhi/core/boot.c:222:3: warning: Variable 'i' is modified but its >> new value is never used. [unreadVariable] i++; ^ vim +/i +222 drivers/bus/mhi/core/boot.c cd457afb166705 Manivannan Sadhasivam 2020-02-20 203 static void mhi_firmware_copy(struct mhi_controller *mhi_cntrl, cd457afb166705 Manivannan Sadhasivam 2020-02-20 204 const struct firmware *firmware, cd457afb166705 Manivannan Sadhasivam 2020-02-20 205 struct image_info *img_info) cd457afb166705 Manivannan Sadhasivam 2020-02-20 206 { cd457afb166705 Manivannan Sadhasivam 2020-02-20 207size_t remainder = firmware->size; cd457afb166705 Manivannan Sadhasivam 2020-02-20 208size_t to_cpy; cd457afb166705 Manivannan Sadhasivam 2020-02-20 209const u8 *buf = firmware->data; cd457afb166705 Manivannan Sadhasivam 2020-02-20 210int i = 0; cd457afb166705 Manivannan Sadhasivam 2020-02-20 211struct mhi_buf *mhi_buf = img_info->mhi_buf; cd457afb166705 Manivannan Sadhasivam 2020-02-20 212struct bhi_vec_entry *bhi_vec = img_info->bhi_vec; cd457afb166705 Manivannan Sadhasivam 2020-02-20 213 cd457afb166705 Manivannan Sadhasivam 2020-02-20 214while (remainder) { cd457afb166705 Manivannan Sadhasivam 2020-02-20 215to_cpy = min(remainder, mhi_buf->len); cd457afb166705 Manivannan Sadhasivam 2020-02-20 216 memcpy(mhi_buf->buf, buf, to_cpy); cd457afb166705 Manivannan Sadhasivam 2020-02-20 217 bhi_vec->dma_addr = mhi_buf->dma_addr; cd457afb166705 Manivannan Sadhasivam 2020-02-20 218bhi_vec->size = to_cpy; cd457afb166705 Manivannan Sadhasivam 2020-02-20 219 cd457afb166705 Manivannan Sadhasivam 2020-02-20 220buf += to_cpy; cd457afb166705 Manivannan Sadhasivam 2020-02-20 221remainder -= to_cpy; cd457afb166705 Manivannan Sadhasivam 2020-02-20 @222i++; Delete i. cd457afb166705 Manivannan Sadhasivam 2020-02-20 223bhi_vec++; cd457afb166705 Manivannan Sadhasivam 2020-02-20 224mhi_buf++; cd457afb166705 Manivannan Sadhasivam 2020-02-20 225} cd457afb166705 Manivannan Sadhasivam 2020-02-20 226 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org ___ kbuild mailing list -- kbu...@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
drivers/phy/qualcomm/phy-qcom-qmp.c:3900 qcom_qmp_phy_probe() error: uninitialized symbol 'dp_serdes'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 986b9eacb25910865b50e5f298aa8e2df7642f1b commit: 52e013d0bffa2238746b246074272817ec8e0807 phy: qcom-qmp: Add support for DP in USB3+DP combo phy config: i386-randconfig-m021-20201026 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/phy/qualcomm/phy-qcom-qmp.c:3900 qcom_qmp_phy_probe() error: uninitialized symbol 'dp_serdes'. Old smatch warnings: drivers/phy/qualcomm/phy-qcom-qmp.c:3719 qcom_qmp_phy_create() warn: 'qphy->pcs' not released on lines: 3684,3695,3710. drivers/phy/qualcomm/phy-qcom-qmp.c:3719 qcom_qmp_phy_create() warn: 'qphy->rx' not released on lines: 3684,3695,3710. drivers/phy/qualcomm/phy-qcom-qmp.c:3719 qcom_qmp_phy_create() warn: 'qphy->tx' not released on lines: 3684,3695,3710. drivers/phy/qualcomm/phy-qcom-qmp.c:3899 qcom_qmp_phy_probe() error: uninitialized symbol 'dp_cfg'. drivers/phy/qualcomm/phy-qcom-qmp.c:3902 qcom_qmp_phy_probe() error: uninitialized symbol 'usb_cfg'. vim +/dp_serdes +3900 drivers/phy/qualcomm/phy-qcom-qmp.c e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3797 static int qcom_qmp_phy_probe(struct platform_device *pdev) e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3798 { e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3799 struct qcom_qmp *qmp; e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3800 struct device *dev = >dev; e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3801 struct device_node *child; e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3802 struct phy_provider *phy_provider; aa968cb1a67e27 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3803 void __iomem *serdes; 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3804 void __iomem *usb_serdes; 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3805 void __iomem *dp_serdes; 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3806 const struct qmp_phy_combo_cfg *combo_cfg = NULL; aa968cb1a67e27 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3807 const struct qmp_phy_cfg *cfg; 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3808 const struct qmp_phy_cfg *usb_cfg; 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3809 const struct qmp_phy_cfg *dp_cfg; 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3810 int num, id, expected_phys; e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3811 int ret; e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3812 e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3813 qmp = devm_kzalloc(dev, sizeof(*qmp), GFP_KERNEL); e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3814 if (!qmp) e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3815 return -ENOMEM; e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3816 e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3817 qmp->dev = dev; e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3818 dev_set_drvdata(dev, qmp); e78f3d15e115e8 drivers/phy/phy-qcom-qmp.c Vivek Gautam 2017-04-06 3819 efb05a50c956b4 drivers/phy/qualcomm/phy-qcom-qmp.c Manu Gautam 2018-01-16 3820 /* Get the specific init parameters of QMP phy */ aa968cb1a67e27 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3821 cfg = of_device_get_match_data(dev); 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3822 if (!cfg) { 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3823 const struct of_device_id *match; 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3824 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3825 match = of_match_device(qcom_qmp_combo_phy_of_match_table, dev); 52e013d0bffa22 drivers/phy/qualcomm/phy-qcom-qmp.c Stephen Boyd 2020-09-16 3826 if (!match) efb05a50c956b4 drivers/phy/qualcomm/phy-qcom-qmp.c Manu Gautam
drivers/gpu/drm/exynos/exynos_drm_dma.c:144 exynos_drm_register_dma() error: uninitialized symbol 'mapping'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: d76913908102044f14381df865bb74df17a538cb commit: b4ceb4a5359ed1c9ba4a20acf3a70d4bbead3248 iommu: Tidy up Kconfig for SoC IOMMUs config: i386-randconfig-m021-20201026 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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 67fbf3a3ef8443 Andrzej Hajda2018-10-12 @144 if (IS_ERR(mapping)) 67fbf3a3ef8443 Andrzej Hajda2018-10-12 145 return PTR_ERR(mapping); In the attached config CONFIG_EXYNOS_IOMMU=y and the other configs are disabled so it seems like this is a reasonable warning. 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
drivers/reset/reset-socfpga.c:67 a10_reset_init() warn: 'data->membase' not released on lines: 67.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: d76913908102044f14381df865bb74df17a538cb commit: 97c9801a15e5b0c9a20e495b2ccabf010894e74b asm-generic: don't provide ioremap for CONFIG_MMU config: h8300-randconfig-m031-20201025 (attached as .config) compiler: h8300-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/reset/reset-socfpga.c:67 a10_reset_init() warn: 'data->membase' not released on lines: 67. drivers/reset/reset-socfpga.c:67 a10_reset_init() warn: 'res.start' not released on lines: 67. vim +67 drivers/reset/reset-socfpga.c b3ca9888f35fa69 Dinh Nguyen 2018-11-13 23 static int a10_reset_init(struct device_node *np) b3ca9888f35fa69 Dinh Nguyen 2018-11-13 24 { b3ca9888f35fa69 Dinh Nguyen 2018-11-13 25 struct reset_simple_data *data; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 26 struct resource res; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 27 resource_size_t size; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 28 int ret; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 29 u32 reg_offset = 0x10; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 30 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 31 data = kzalloc(sizeof(*data), GFP_KERNEL); b3ca9888f35fa69 Dinh Nguyen 2018-11-13 32 if (!data) b3ca9888f35fa69 Dinh Nguyen 2018-11-13 33 return -ENOMEM; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 34 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 35 ret = of_address_to_resource(np, 0, ); b3ca9888f35fa69 Dinh Nguyen 2018-11-13 36 if (ret) b3ca9888f35fa69 Dinh Nguyen 2018-11-13 37 goto err_alloc; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 38 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 39 size = resource_size(); b3ca9888f35fa69 Dinh Nguyen 2018-11-13 40 if (!request_mem_region(res.start, size, np->name)) { b3ca9888f35fa69 Dinh Nguyen 2018-11-13 41 ret = -EBUSY; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 42 goto err_alloc; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 43 } b3ca9888f35fa69 Dinh Nguyen 2018-11-13 44 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 45 data->membase = ioremap(res.start, size); b3ca9888f35fa69 Dinh Nguyen 2018-11-13 46 if (!data->membase) { b3ca9888f35fa69 Dinh Nguyen 2018-11-13 47 ret = -ENOMEM; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 48 goto err_alloc; Need to release the mem_region. b3ca9888f35fa69 Dinh Nguyen 2018-11-13 49 } b3ca9888f35fa69 Dinh Nguyen 2018-11-13 50 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 51 if (of_property_read_u32(np, "altr,modrst-offset", _offset)) b3ca9888f35fa69 Dinh Nguyen 2018-11-13 52 pr_warn("missing altr,modrst-offset property, assuming 0x10\n"); b3ca9888f35fa69 Dinh Nguyen 2018-11-13 53 data->membase += reg_offset; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 54 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 55 spin_lock_init(>lock); b3ca9888f35fa69 Dinh Nguyen 2018-11-13 56 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 57 data->rcdev.owner = THIS_MODULE; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 58 data->rcdev.nr_resets = SOCFPGA_NR_BANKS * 32; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 59 data->rcdev.ops = _simple_ops; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 60 data->rcdev.of_node = np; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 61 data->status_active_low = true; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 62 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 63 return reset_controller_register(>rcdev); ^^^ Need error handling if this fails. b3ca9888f35fa69 Dinh Nguyen 2018-11-13 64 b3ca9888f35fa69 Dinh Nguyen 2018-11-13 65 err_alloc: b3ca9888f35fa69 Dinh Nguyen 2018-11-13 66 kfree(data); b3ca9888f35fa69 Dinh Nguyen 2018-11-13 @67 return ret; b3ca9888f35fa69 Dinh Nguyen 2018-11-13 68 }; --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH 1/2] media: i2c: Add driver for the Sony Exmor-RS IMX300 camera sensor
Hi, url: https://github.com/0day-ci/linux/commits/kholk11-gmail-com/Add-support-for-the-Sony-Exmor-RS-IMX300-camera-sensor/20201018-203244 base: git://linuxtv.org/media_tree.git master config: x86_64-randconfig-m001-20201022 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/media/i2c/imx300.c:2413 imx300_set_framefmt() error: uninitialized symbol 'ret'. vim +/ret +2413 drivers/media/i2c/imx300.c c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2377 static int imx300_set_framefmt(struct imx300 *imx300) c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2378 { c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2379 int ret; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2380 c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2381 switch (imx300->fmt.code) { c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2382 case MEDIA_BUS_FMT_SRGGB8_1X8: c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2383 fallthrough; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2384 case MEDIA_BUS_FMT_SGRBG8_1X8: c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2385 fallthrough; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2386 case MEDIA_BUS_FMT_SGBRG8_1X8: c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2387 fallthrough; These fallthrough annotations are not required. c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2388 case MEDIA_BUS_FMT_SBGGR8_1X8: c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2389 ret = imx300_write_regs(imx300, raw8_framefmt_regs, c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2390 ARRAY_SIZE(raw8_framefmt_regs)); c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2391 if (ret) c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2392 return ret; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2393 imx300->cur_bps = 8; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2394 break; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2395 case MEDIA_BUS_FMT_SRGGB10_1X10: c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2396 fallthrough; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2397 case MEDIA_BUS_FMT_SGRBG10_1X10: c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2398 fallthrough; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2399 case MEDIA_BUS_FMT_SGBRG10_1X10: c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2400 fallthrough; It would look a lot nicer with the annotations removed. Fall through is assumed with an empty label. c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2401 case MEDIA_BUS_FMT_SBGGR10_1X10: c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2402 ret = imx300_write_regs(imx300, raw10_framefmt_regs, c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2403 ARRAY_SIZE(raw10_framefmt_regs)); c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2404 if (ret) c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2405 return ret; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2406 imx300->cur_bps = 10; c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2407 break; No default case. c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2408 } c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2409 c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2410 /* Update the pixel rate to eventually save some power */ c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2411 __v4l2_ctrl_s_ctrl_int64(imx300->pixel_rate, get_pixel_rate(imx300)); c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2412 c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 @2413 return ret; Just "return 0;" It's more readable to return a literal. c82629fb21ade4 AngeloGioacchino Del Regno 2020-10-18 2414 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH 12/14] media: sunxi: Add support for the A83T MIPI CSI-2 controller
On Fri, Oct 23, 2020 at 07:45:44PM +0200, Paul Kocialkowski wrote: > +static int sun8i_a83t_mipi_csi2_v4l2_setup(struct sun8i_a83t_mipi_csi2_dev > *cdev) > +{ > + struct sun8i_a83t_mipi_csi2_video *video = >video; > + struct v4l2_subdev *subdev = >subdev; > + struct v4l2_async_notifier *notifier = >notifier; > + struct fwnode_handle *handle; > + struct v4l2_fwnode_endpoint *endpoint; > + int ret; > + > + /* Subdev */ > + > + v4l2_subdev_init(subdev, _a83t_mipi_csi2_subdev_ops); > + subdev->dev = cdev->dev; > + strscpy(subdev->name, MODULE_NAME, sizeof(subdev->name)); > + v4l2_set_subdevdata(subdev, cdev); > + > + /* Entity */ > + > + subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; > + subdev->entity.ops = _a83t_mipi_csi2_entity_ops; > + > + /* Pads */ > + > + video->pads[0].flags = MEDIA_PAD_FL_SINK; > + video->pads[1].flags = MEDIA_PAD_FL_SOURCE; > + > + ret = media_entity_pads_init(>entity, 2, video->pads); > + if (ret) > + return ret; > + > + /* Endpoint */ > + > + handle = fwnode_graph_get_endpoint_by_id(dev_fwnode(cdev->dev), 0, 0, > + FWNODE_GRAPH_ENDPOINT_NEXT); > + if (!handle) > + goto error_media_entity; Missing error code. > + > + endpoint = >endpoint; > + endpoint->bus_type = V4L2_MBUS_CSI2_DPHY; > + > + ret = v4l2_fwnode_endpoint_parse(handle, endpoint); > + fwnode_handle_put(handle); > + if (ret) > + goto error_media_entity; > + > + /* Notifier */ > + > + v4l2_async_notifier_init(notifier); > + > + ret = v4l2_async_notifier_add_fwnode_remote_subdev(notifier, handle, > + > >subdev_async); > + if (ret) > + goto error_media_entity; > + > + video->notifier.ops = _a83t_mipi_csi2_notifier_ops; > + > + ret = v4l2_async_subdev_notifier_register(subdev, notifier); > + if (ret < 0) > + goto error_notifier; > + > + /* Subdev */ > + > + ret = v4l2_async_register_subdev(subdev); > + if (ret < 0) > + goto error_notifier_registered; > + > + return 0; > + > +error_notifier_registered: > + v4l2_async_notifier_unregister(notifier); > +error_notifier: > + v4l2_async_notifier_cleanup(notifier); > +error_media_entity: > + media_entity_cleanup(>entity); > + > + return ret; > +} regards, dan carpenter
Re: [PATCH 08/14] media: sunxi: Add support for the A31 MIPI CSI-2 controller
. > + * > + * However, reading the version appears necessary for it to work > + * reliably. Replacing it with a delay doesn't do the trick. > + */ > + regmap_write(regmap, SUN6I_MIPI_CSI2_CTL_REG, > + SUN6I_MIPI_CSI2_CTL_RESET_N | > + SUN6I_MIPI_CSI2_CTL_VERSION_EN | > + SUN6I_MIPI_CSI2_CTL_UNPK_EN); > + > + regmap_read(regmap, SUN6I_MIPI_CSI2_VERSION_REG, ); > + > + regmap_update_bits(regmap, SUN6I_MIPI_CSI2_CTL_REG, > +SUN6I_MIPI_CSI2_CTL_VERSION_EN, 0); > + > + dev_dbg(cdev->dev, "A31 MIPI CSI-2 version: %04x\n", version); > + > + regmap_write(regmap, SUN6I_MIPI_CSI2_CFG_REG, > + SUN6I_MIPI_CSI2_CFG_CHANNEL_MODE(1) | > + SUN6I_MIPI_CSI2_CFG_LANE_COUNT(lanes_count)); > + > + regmap_write(regmap, SUN6I_MIPI_CSI2_VCDT_RX_REG, > + SUN6I_MIPI_CSI2_VCDT_RX_CH_VC(3, 3) | > + SUN6I_MIPI_CSI2_VCDT_RX_CH_VC(2, 2) | > + SUN6I_MIPI_CSI2_VCDT_RX_CH_VC(1, 1) | > + SUN6I_MIPI_CSI2_VCDT_RX_CH_VC(0, 0) | > + SUN6I_MIPI_CSI2_VCDT_RX_CH_DT(0, data_type)); > + > + regmap_update_bits(regmap, SUN6I_MIPI_CSI2_CTL_REG, > +SUN6I_MIPI_CSI2_CTL_EN, SUN6I_MIPI_CSI2_CTL_EN); > + > + ret = v4l2_subdev_call(remote_subdev, video, s_stream, 1); > + if (ret) > + goto disable; > + > + return 0; > +} > + [ snip ] > +static int sun6i_mipi_csi2_v4l2_setup(struct sun6i_mipi_csi2_dev *cdev) > +{ > + struct sun6i_mipi_csi2_video *video = >video; > + struct v4l2_subdev *subdev = >subdev; > + struct v4l2_async_notifier *notifier = >notifier; > + struct fwnode_handle *handle; > + struct v4l2_fwnode_endpoint *endpoint; > + int ret; > + > + /* Subdev */ > + > + v4l2_subdev_init(subdev, _mipi_csi2_subdev_ops); > + subdev->dev = cdev->dev; > + strscpy(subdev->name, MODULE_NAME, sizeof(subdev->name)); > + v4l2_set_subdevdata(subdev, cdev); > + > + /* Entity */ > + > + subdev->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE; > + subdev->entity.ops = _mipi_csi2_entity_ops; > + > + /* Pads */ > + > + video->pads[0].flags = MEDIA_PAD_FL_SINK; > + video->pads[1].flags = MEDIA_PAD_FL_SOURCE; > + > + ret = media_entity_pads_init(>entity, 2, video->pads); > + if (ret) > + return ret; > + > + /* Endpoint */ > + > + handle = fwnode_graph_get_endpoint_by_id(dev_fwnode(cdev->dev), 0, 0, > + FWNODE_GRAPH_ENDPOINT_NEXT); > + if (!handle) > + goto error_media_entity; Missing error code. > + > + endpoint = >endpoint; > + endpoint->bus_type = V4L2_MBUS_CSI2_DPHY; > + > + ret = v4l2_fwnode_endpoint_parse(handle, endpoint); > + fwnode_handle_put(handle); > + if (ret) > + goto error_media_entity; > + > + /* Notifier */ > + > + v4l2_async_notifier_init(notifier); > + > + ret = v4l2_async_notifier_add_fwnode_remote_subdev(notifier, handle, > + > >subdev_async); > + if (ret) > + goto error_media_entity; > + > + video->notifier.ops = _mipi_csi2_notifier_ops; > + > + ret = v4l2_async_subdev_notifier_register(subdev, notifier); > + if (ret < 0) > + goto error_notifier; > + > + /* Subdev */ > + > + ret = v4l2_async_register_subdev(subdev); > + if (ret < 0) > + goto error_notifier_registered; > + > + return 0; > + > +error_notifier_registered: > + v4l2_async_notifier_unregister(notifier); > +error_notifier: > + v4l2_async_notifier_cleanup(notifier); > +error_media_entity: > + media_entity_cleanup(>entity); > + > + return ret; > +} regards, dan carpenter
Re: [PATCH] tcp: fix race condition when creating child sockets from syncookies
Hi Ricardo, url: https://github.com/0day-ci/linux/commits/Ricardo-Dias/tcp-fix-race-condition-when-creating-child-sockets-from-syncookies/20201023-191433 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 105faa8742437c28815b2a3eb8314ebc5fd9288c config: i386-randconfig-m021-20201022 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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: net/ipv4/inet_hashtables.c:570 inet_ehash_insert_chk_dup() error: uninitialized symbol 'dif'. vim +/dif +570 net/ipv4/inet_hashtables.c 35d7202175fe2c3 Ricardo Dias 2020-10-23 544 struct sock *inet_ehash_insert_chk_dup(struct sock *sk) 35d7202175fe2c3 Ricardo Dias 2020-10-23 545 { 35d7202175fe2c3 Ricardo Dias 2020-10-23 546struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; 35d7202175fe2c3 Ricardo Dias 2020-10-23 547struct hlist_nulls_head *list; 35d7202175fe2c3 Ricardo Dias 2020-10-23 548struct inet_ehash_bucket *head; 35d7202175fe2c3 Ricardo Dias 2020-10-23 549const struct hlist_nulls_node *node; 35d7202175fe2c3 Ricardo Dias 2020-10-23 550struct sock *esk; 35d7202175fe2c3 Ricardo Dias 2020-10-23 551spinlock_t *lock; /* protects hashinfo socket entry */ 35d7202175fe2c3 Ricardo Dias 2020-10-23 552struct net *net = sock_net(sk); 35d7202175fe2c3 Ricardo Dias 2020-10-23 553const int dif, sdif = sk->sk_bound_dev_if; ^^^ "dif" is never initialized. 35d7202175fe2c3 Ricardo Dias 2020-10-23 554 35d7202175fe2c3 Ricardo Dias 2020-10-23 555INET_ADDR_COOKIE(acookie, sk->sk_daddr, sk->sk_rcv_saddr); 35d7202175fe2c3 Ricardo Dias 2020-10-23 556const __portpair ports = INET_COMBINED_PORTS(sk->sk_dport, sk->sk_num); 35d7202175fe2c3 Ricardo Dias 2020-10-23 557 35d7202175fe2c3 Ricardo Dias 2020-10-23 558WARN_ON_ONCE(!sk_unhashed(sk)); 35d7202175fe2c3 Ricardo Dias 2020-10-23 559 35d7202175fe2c3 Ricardo Dias 2020-10-23 560sk->sk_hash = sk_ehashfn(sk); 35d7202175fe2c3 Ricardo Dias 2020-10-23 561head = inet_ehash_bucket(hashinfo, sk->sk_hash); 35d7202175fe2c3 Ricardo Dias 2020-10-23 562list = >chain; 35d7202175fe2c3 Ricardo Dias 2020-10-23 563lock = inet_ehash_lockp(hashinfo, sk->sk_hash); 35d7202175fe2c3 Ricardo Dias 2020-10-23 564 35d7202175fe2c3 Ricardo Dias 2020-10-23 565spin_lock(lock); 35d7202175fe2c3 Ricardo Dias 2020-10-23 566 begin: 35d7202175fe2c3 Ricardo Dias 2020-10-23 567sk_nulls_for_each_rcu(esk, node, list) { 35d7202175fe2c3 Ricardo Dias 2020-10-23 568if (esk->sk_hash != sk->sk_hash) 35d7202175fe2c3 Ricardo Dias 2020-10-23 569continue; 35d7202175fe2c3 Ricardo Dias 2020-10-23 @570if (likely(INET_MATCH(esk, net, acookie, 35d7202175fe2c3 Ricardo Dias 2020-10-23 571 sk->sk_daddr, sk->sk_rcv_saddr, ports, 35d7202175fe2c3 Ricardo Dias 2020-10-23 572 dif, sdif))) { ^^^ warning. 35d7202175fe2c3 Ricardo Dias 2020-10-23 573if (unlikely(!refcount_inc_not_zero(>sk_refcnt))) 35d7202175fe2c3 Ricardo Dias 2020-10-23 574goto out; 35d7202175fe2c3 Ricardo Dias 2020-10-23 575if (unlikely(!INET_MATCH(esk, net, acookie, 35d7202175fe2c3 Ricardo Dias 2020-10-23 576 sk->sk_daddr, 35d7202175fe2c3 Ricardo Dias 2020-10-23 577 sk->sk_rcv_saddr, ports, 35d7202175fe2c3 Ricardo Dias 2020-10-23 578 dif, sdif))) { 35d7202175fe2c3 Ricardo Dias 2020-10-23 579 sock_gen_put(esk); 35d7202175fe2c3 Ricardo Dias 2020-10-23 580goto begin; 35d7202175fe2c3 Ricardo Dias 2020-10-23 581} 35d7202175fe2c3 Ricardo Dias 2020-10-23 582goto found; 35d7202175fe2c3 Ricardo Dias 2020-10-23 583} 35d7202175fe2c3 Ricardo Dias 2020-10-23 584} 35d7202175fe2c3 Ricardo Dias 2020-10-23 585 out: 35d7202175fe2c3 Ricardo Dias 2020-10-23 586esk = NULL; 35d7202175fe2c3 Ricardo Dias 2020-10-23 587__sk_nulls_add_node_rcu(sk, list); 35d7202175fe2c3 Ricardo Dias 2020-10-23 588 found: 35d7202175fe2c3 Ricardo Dias 2020-10-23 589spin_unlock(lock); 35d7202175fe2c3 Ricardo Dias 2020-10-23 590if (esk) { 35d7202175fe2c3 Ricardo Dias 2020-10-23 591 percpu_counter_inc(sk->sk_prot->orphan_count); 35d7202175fe2c3 Ricardo Dias 2020-10-23 592inet_sk_set_state(sk, TCP_CLOSE); 35d7202175fe2c3 Ricardo Dias 2020-10-23 593sock_set_flag(sk, SOCK_DEAD); 35d7202175f
Re: [PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup()
On Mon, Oct 26, 2020 at 11:18:16AM +0800, Yunsheng Lin wrote: > On 2020/10/23 19:22, Dan Carpenter wrote: > > Smatch complains that "ret" might be uninitialized if we don't enter > > the loop. We do always enter the loop so it's a false positive, but > > it's cleaner to just return a literal zero and that silences the > > warning as well. > > Thanks for the clean up. Minor comment below: > Perhap it makes sense to limit ret scope within the for loop after > returning zero. > It's not really normal to limit ret scope... I think it's better to leave it as-is. regards, dan carpenter
Re: [PATCH] drm/i915: Fix a crash in shmem_pin_map() error handling
On Fri, Oct 23, 2020 at 02:19:41PM +0200, Christoph Hellwig wrote: > > diff --git a/drivers/gpu/drm/i915/gt/shmem_utils.c > > b/drivers/gpu/drm/i915/gt/shmem_utils.c > > index f011ea42487e..7eb542018219 100644 > > --- a/drivers/gpu/drm/i915/gt/shmem_utils.c > > +++ b/drivers/gpu/drm/i915/gt/shmem_utils.c > > @@ -52,8 +52,9 @@ struct file *shmem_create_from_object(struct > > drm_i915_gem_object *obj) > > void *shmem_pin_map(struct file *file) > > { > > struct page **pages; > > - size_t n_pages, i; > > + size_t n_pages; > > void *vaddr; > > + int i; > > > > n_pages = file->f_mapping->host->i_size >> PAGE_SHIFT; > > pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL); > > This assumes we never have more than INT_MAX worth of pages before > a failure. Doh. Yeah. My bad. regards, dan carpenter
Re: [PATCH v2 2/2] f2fs: add F2FS_IOC_SET_COMPRESS_OPTION ioctl
Hi Daeho, url: https://github.com/0day-ci/linux/commits/Daeho-Jeong/f2fs-add-F2FS_IOC_GET_COMPRESS_OPTION-ioctl/20201022-115947 base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test config: x86_64-randconfig-m001-20201022 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/f2fs/file.c:4011 f2fs_ioc_set_compress_option() error: uninitialized symbol 'ret'. Old smatch warnings: fs/f2fs/f2fs.h:2127 dec_valid_block_count() warn: should 'count << 3' be a 64 bit type? fs/f2fs/file.c:2525 f2fs_ioc_gc_range() warn: inconsistent returns 'sbi->gc_lock'. fs/f2fs/file.c:2941 f2fs_ioc_flush_device() warn: potential spectre issue 'sbi->devs' [w] (local cap) fs/f2fs/file.c:2966 f2fs_ioc_flush_device() warn: inconsistent returns 'sbi->gc_lock'. fs/f2fs/file.c:3305 f2fs_precache_extents() error: uninitialized symbol 'err'. vim +/ret +4011 fs/f2fs/file.c d869d11ac39edb Daeho Jeong 2020-10-22 3969 static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg) d869d11ac39edb Daeho Jeong 2020-10-22 3970 { d869d11ac39edb Daeho Jeong 2020-10-22 3971 struct inode *inode = file_inode(filp); d869d11ac39edb Daeho Jeong 2020-10-22 3972 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); d869d11ac39edb Daeho Jeong 2020-10-22 3973 struct f2fs_comp_option option; d869d11ac39edb Daeho Jeong 2020-10-22 3974 int ret; d869d11ac39edb Daeho Jeong 2020-10-22 3975 d869d11ac39edb Daeho Jeong 2020-10-22 3976 if (!f2fs_sb_has_compression(sbi)) d869d11ac39edb Daeho Jeong 2020-10-22 3977 return -EOPNOTSUPP; d869d11ac39edb Daeho Jeong 2020-10-22 3978 d869d11ac39edb Daeho Jeong 2020-10-22 3979 if (!f2fs_compressed_file(inode)) d869d11ac39edb Daeho Jeong 2020-10-22 3980 return -EINVAL; d869d11ac39edb Daeho Jeong 2020-10-22 3981 d869d11ac39edb Daeho Jeong 2020-10-22 3982 if (!(filp->f_mode & FMODE_WRITE)) d869d11ac39edb Daeho Jeong 2020-10-22 3983 return -EBADF; d869d11ac39edb Daeho Jeong 2020-10-22 3984 d869d11ac39edb Daeho Jeong 2020-10-22 3985 if (copy_from_user(, (struct f2fs_comp_option __user *)arg, d869d11ac39edb Daeho Jeong 2020-10-22 3986 sizeof(option))) d869d11ac39edb Daeho Jeong 2020-10-22 3987 return -EFAULT; d869d11ac39edb Daeho Jeong 2020-10-22 3988 d869d11ac39edb Daeho Jeong 2020-10-22 3989 if (option.log_cluster_size < MIN_COMPRESS_LOG_SIZE || d869d11ac39edb Daeho Jeong 2020-10-22 3990 option.log_cluster_size > MAX_COMPRESS_LOG_SIZE || d869d11ac39edb Daeho Jeong 2020-10-22 3991 !f2fs_is_compress_algorithm_ready(option.algorithm)) d869d11ac39edb Daeho Jeong 2020-10-22 3992 return -EINVAL; d869d11ac39edb Daeho Jeong 2020-10-22 3993 d869d11ac39edb Daeho Jeong 2020-10-22 3994 file_start_write(filp); d869d11ac39edb Daeho Jeong 2020-10-22 3995 inode_lock(inode); d869d11ac39edb Daeho Jeong 2020-10-22 3996 d869d11ac39edb Daeho Jeong 2020-10-22 3997 if (f2fs_is_mmap_file(inode) || d869d11ac39edb Daeho Jeong 2020-10-22 3998 get_dirty_pages(inode) || inode->i_size) { d869d11ac39edb Daeho Jeong 2020-10-22 3999 ret = -EINVAL; d869d11ac39edb Daeho Jeong 2020-10-22 4000 goto out; d869d11ac39edb Daeho Jeong 2020-10-22 4001 } d869d11ac39edb Daeho Jeong 2020-10-22 4002 d869d11ac39edb Daeho Jeong 2020-10-22 4003 F2FS_I(inode)->i_compress_algorithm = option.algorithm; d869d11ac39edb Daeho Jeong 2020-10-22 4004 F2FS_I(inode)->i_log_cluster_size = option.log_cluster_size; d869d11ac39edb Daeho Jeong 2020-10-22 4005 F2FS_I(inode)->i_cluster_size = 1 << option.log_cluster_size; d869d11ac39edb Daeho Jeong 2020-10-22 4006 f2fs_mark_inode_dirty_sync(inode, true); "ret" is uninitialized on the success path. d869d11ac39edb Daeho Jeong 2020-10-22 4007 out: d869d11ac39edb Daeho Jeong 2020-10-22 4008 inode_unlock(inode); d869d11ac39edb Daeho Jeong 2020-10-22 4009 file_end_write(filp); d869d11ac39edb Daeho Jeong 2020-10-22 4010 d869d11ac39edb Daeho Jeong 2020-10-22 @4011 return ret; d869d11ac39edb Daeho Jeong 2020-10-22 4012 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH 1/2] vfio/fsl-mc: return -EFAULT if copy_to_user() fails
The copy_to_user() function returns the number of bytes remaining to be copied, but this code should return -EFAULT. Fixes: df747bcd5b21 ("vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call") Signed-off-by: Dan Carpenter --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c index 0113a980f974..21f22e3da11f 100644 --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c @@ -248,7 +248,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, info.size = vdev->regions[info.index].size; info.flags = vdev->regions[info.index].flags; - return copy_to_user((void __user *)arg, , minsz); + if (copy_to_user((void __user *)arg, , minsz)) + return -EFAULT; + return 0; } case VFIO_DEVICE_GET_IRQ_INFO: { @@ -267,7 +269,9 @@ static long vfio_fsl_mc_ioctl(void *device_data, unsigned int cmd, info.flags = VFIO_IRQ_INFO_EVENTFD; info.count = 1; - return copy_to_user((void __user *)arg, , minsz); + if (copy_to_user((void __user *)arg, , minsz)) + return -EFAULT; + return 0; } case VFIO_DEVICE_SET_IRQS: { -- 2.28.0
[PATCH] drm/i915: Fix a crash in shmem_pin_map() error handling
There is a signedness bug in shmem_pin_map() error handling because "i" is unsigned. The "while (--i >= 0)" will loop forever until the system crashes. Fixes: bfed6708d6c9 ("drm/i915: use vmap in shmem_pin_map") Signed-off-by: Dan Carpenter --- drivers/gpu/drm/i915/gt/shmem_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/shmem_utils.c b/drivers/gpu/drm/i915/gt/shmem_utils.c index f011ea42487e..7eb542018219 100644 --- a/drivers/gpu/drm/i915/gt/shmem_utils.c +++ b/drivers/gpu/drm/i915/gt/shmem_utils.c @@ -52,8 +52,9 @@ struct file *shmem_create_from_object(struct drm_i915_gem_object *obj) void *shmem_pin_map(struct file *file) { struct page **pages; - size_t n_pages, i; + size_t n_pages; void *vaddr; + int i; n_pages = file->f_mapping->host->i_size >> PAGE_SHIFT; pages = kvmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL); -- 2.28.0
[PATCH 2/2] vfio/fsl-mc: prevent underflow in vfio_fsl_mc_mmap()
My static analsysis tool complains that the "index" can be negative. There are some checks in do_mmap() which try to prevent underflows but I don't know if they are sufficient for this situation. Either way, making "index" unsigned is harmless so let's do it just to be safe. Fixes: 67247289688d ("vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions") Signed-off-by: Dan Carpenter --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c index 21f22e3da11f..f27e25112c40 100644 --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c @@ -472,7 +472,7 @@ static int vfio_fsl_mc_mmap(void *device_data, struct vm_area_struct *vma) { struct vfio_fsl_mc_device *vdev = device_data; struct fsl_mc_device *mc_dev = vdev->mc_dev; - int index; + unsigned int index; index = vma->vm_pgoff >> (VFIO_FSL_MC_OFFSET_SHIFT - PAGE_SHIFT); -- 2.28.0
[PATCH net] net: hns3: clean up a return in hclge_tm_bp_setup()
Smatch complains that "ret" might be uninitialized if we don't enter the loop. We do always enter the loop so it's a false positive, but it's cleaner to just return a literal zero and that silences the warning as well. Signed-off-by: Dan Carpenter --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index 15f69fa86323..e8495f58a1a8 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -1373,7 +1373,7 @@ static int hclge_tm_bp_setup(struct hclge_dev *hdev) return ret; } - return ret; + return 0; } int hclge_pause_setup_hw(struct hclge_dev *hdev, bool init) -- 2.28.0
Re: [PATCH v2 2/7] staging: qlge: Initialize devlink health dump framework
On Wed, Oct 14, 2020 at 06:43:01PM +0800, Coiby Xu wrote: > static int qlge_probe(struct pci_dev *pdev, > const struct pci_device_id *pci_entry) > { > struct net_device *ndev = NULL; > struct qlge_adapter *qdev = NULL; > + struct devlink *devlink; > static int cards_found; > int err = 0; > > - ndev = alloc_etherdev_mq(sizeof(struct qlge_adapter), > + devlink = devlink_alloc(_devlink_ops, sizeof(struct qlge_adapter)); > + if (!devlink) > + return -ENOMEM; > + > + qdev = devlink_priv(devlink); > + > + ndev = alloc_etherdev_mq(sizeof(struct qlge_netdev_priv), >min(MAX_CPUS, >netif_get_num_default_rss_queues())); > if (!ndev) > - return -ENOMEM; > + goto devlink_free; > > - err = qlge_init_device(pdev, ndev, cards_found); > - if (err < 0) { > - free_netdev(ndev); > - return err; In the old code, if qlge_init_device() fails then it frees "ndev". > - } > + qdev->ndev = ndev; > + err = qlge_init_device(pdev, qdev, cards_found); > + if (err < 0) > + goto devlink_free; But the patch introduces a new resource leak. > > - qdev = netdev_priv(ndev); > SET_NETDEV_DEV(ndev, >dev); > ndev->hw_features = NETIF_F_SG | > NETIF_F_IP_CSUM | > @@ -4611,8 +4619,14 @@ static int qlge_probe(struct pci_dev *pdev, > qlge_release_all(pdev); > pci_disable_device(pdev); > free_netdev(ndev); > - return err; > + goto devlink_free; > } > + > + err = devlink_register(devlink, >dev); > + if (err) > + goto devlink_free; > + > + qlge_health_create_reporters(qdev); > /* Start up the timer to trigger EEH if >* the bus goes dead >*/ > @@ -4623,6 +4637,10 @@ static int qlge_probe(struct pci_dev *pdev, > atomic_set(>lb_count, 0); > cards_found++; > return 0; > + > +devlink_free: > + devlink_free(devlink); > + return err; > } The best way to write error handling code is keep tracke of the most recent allocation which was allocated successfully. one = alloc(); if (!one) return -ENOMEM; // <-- nothing allocated successfully two = alloc(); if (!two) { ret = -ENOMEM; goto free_one; // <-- one was allocated successfully // Notice that the label name says what // the goto does. } three = alloc(); if (!three) { ret = -ENOMEM; goto free_two; // <-- two allocated, two freed. } ... return 0; free_two: free(two); free_one: free(one); return ret; In the old code qlge_probe() freed things before returning, and that's fine if there is only two allocations in the function but when there are three or more allocations, then use gotos to unwind. Ideally there would be a ql_deinit_device() function to mirror the ql_init_device() function. The ql_init_device() is staging quality code with leaks and bad label names. It should be re-written to free things one step at a time instead of calling ql_release_all(). Anyway, let's not introduce new leaks at least. regards, dan carpenter
Re: [PATCH 2/8] staging: wfx: check memory allocation
On Sat, Oct 10, 2020 at 04:18:11PM +0300, Dan Carpenter wrote: > On Sat, Oct 10, 2020 at 02:07:13PM +0200, Jérôme Pouiller wrote: > > On Friday 9 October 2020 20:51:01 CEST Kalle Valo wrote: > > > CAUTION: This email originated from outside of the organization. Do not > > > click links or open attachments unless you recognize the sender and know > > > the content is safe. > > > > > > > > > Jerome Pouiller writes: > > > > > > > From: Jérôme Pouiller > > > > > > > > Smatch complains: > > > > > > > >main.c:228 wfx_send_pdata_pds() warn: potential NULL parameter > > > > dereference 'tmp_buf' > > > >227 tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); > > > >228 ret = wfx_send_pds(wdev, tmp_buf, pds->size); > > > > ^^^ > > > >229 kfree(tmp_buf); > > > > > > > > Reported-by: Dan Carpenter > > > > Signed-off-by: Jérôme Pouiller > > > > --- > > > > drivers/staging/wfx/main.c | 8 +++- > > > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c > > > > index df11c091e094..a8dc2c033410 100644 > > > > --- a/drivers/staging/wfx/main.c > > > > +++ b/drivers/staging/wfx/main.c > > > > @@ -222,12 +222,18 @@ static int wfx_send_pdata_pds(struct wfx_dev > > > > *wdev) > > > > if (ret) { > > > > dev_err(wdev->dev, "can't load PDS file %s\n", > > > > wdev->pdata.file_pds); > > > > - return ret; > > > > + goto err1; > > > > } > > > > tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); > > > > + if (!tmp_buf) { > > > > + ret = -ENOMEM; > > > > + goto err2; > > > > + } > > > > ret = wfx_send_pds(wdev, tmp_buf, pds->size); > > > > kfree(tmp_buf); > > > > +err2: > > > > release_firmware(pds); > > > > +err1: > > > > return ret; > > > > } > > > > > > A minor style issue but using more descriptive error labels make the > > > code more readable and maintainable, especially in a bigger function. > > > For example, err2 could be called err_release_firmware. > > > > > > And actually err1 could be removed and the goto replaced with just > > > "return ret;". Then err2 could be renamed to a simple err. > > > > It was the case in the initial code. However, I have preferred to not > > mix 'return' and 'goto' inside the same function. Probably a matter of > > taste. > > > > Ideally you can read a function from top to bottom and understand with > out skipping around. Imagine if novels were written like that "goto > bottom_of_page;" but then at the bottom it just said "Just kidding". > "return ret;" is more readable than "goto err;" More unasked for exposition: "goto err;" is too vague. It could be one of three things. 1) Do nothing (like this code). 2) Do something specific (choose a better name like goto unlock). 3) Do everything. Do everything code is the most buggy style of error handling. The common bug introduced by type 1 and 2 are "Forgot to set the error code" bugs. Type 3 is a whole nother level of bugginess. Too much bugs to explain. regards, dan carpenter
Re: [PATCH 2/8] staging: wfx: check memory allocation
On Sat, Oct 10, 2020 at 02:07:13PM +0200, Jérôme Pouiller wrote: > On Friday 9 October 2020 20:51:01 CEST Kalle Valo wrote: > > CAUTION: This email originated from outside of the organization. Do not > > click links or open attachments unless you recognize the sender and know > > the content is safe. > > > > > > Jerome Pouiller writes: > > > > > From: Jérôme Pouiller > > > > > > Smatch complains: > > > > > >main.c:228 wfx_send_pdata_pds() warn: potential NULL parameter > > > dereference 'tmp_buf' > > >227 tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); > > >228 ret = wfx_send_pds(wdev, tmp_buf, pds->size); > > > ^^^ > > >229 kfree(tmp_buf); > > > > > > Reported-by: Dan Carpenter > > > Signed-off-by: Jérôme Pouiller > > > --- > > > drivers/staging/wfx/main.c | 8 +++- > > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c > > > index df11c091e094..a8dc2c033410 100644 > > > --- a/drivers/staging/wfx/main.c > > > +++ b/drivers/staging/wfx/main.c > > > @@ -222,12 +222,18 @@ static int wfx_send_pdata_pds(struct wfx_dev *wdev) > > > if (ret) { > > > dev_err(wdev->dev, "can't load PDS file %s\n", > > > wdev->pdata.file_pds); > > > - return ret; > > > + goto err1; > > > } > > > tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); > > > + if (!tmp_buf) { > > > + ret = -ENOMEM; > > > + goto err2; > > > + } > > > ret = wfx_send_pds(wdev, tmp_buf, pds->size); > > > kfree(tmp_buf); > > > +err2: > > > release_firmware(pds); > > > +err1: > > > return ret; > > > } > > > > A minor style issue but using more descriptive error labels make the > > code more readable and maintainable, especially in a bigger function. > > For example, err2 could be called err_release_firmware. > > > > And actually err1 could be removed and the goto replaced with just > > "return ret;". Then err2 could be renamed to a simple err. > > It was the case in the initial code. However, I have preferred to not > mix 'return' and 'goto' inside the same function. Probably a matter of > taste. > Ideally you can read a function from top to bottom and understand with out skipping around. Imagine if novels were written like that "goto bottom_of_page;" but then at the bottom it just said "Just kidding". "return ret;" is more readable than "goto err;" These sorts of rules where "there is only one return per function" are meant to make people think about cleanup before returning. But most of my work is in error handling code and it doesn't help. If people don't think about cleanup, changing the style won't make them start thinking about it. There was one driver which was written with locked code indented one tab and the inventor of that style still introduced a locking bug in his code. spin_lock(); { frob(); frob(); if (ret) return ret; // <-- forgot to unlock; frob(); } spin_unlock(); Btw, I have created a new Smatch check to find unwind bugs. It's called check_unwind.c and it's easy to add new alloc/free pairings to that code. This is the best way to prevent unwind bugs. The style changes don't make a measurable difference in real life and they make the code messy. And GW-BASIC label names are a pox upon the earth. regards, dan carpenter
Re: [PATCH v3 2/2] power: supply: bq25790: Introduce the BQ25790 charger driver
Hi Dan, url: https://github.com/0day-ci/linux/commits/Dan-Murphy/dt-bindings-power-Add-the-bq25790-dt-bindings/20201008-234450 base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next config: i386-randconfig-m021-20201009 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/power/supply/bq25790_charger.c:170 bq25790_usb_work() warn: ignoring unreachable code. drivers/power/supply/bq25790_charger.c:624 bq25790_get_property() warn: should this be a bitwise op? vim +170 drivers/power/supply/bq25790_charger.c bc435a97ea513a3 Dan Murphy 2020-10-08 154 static void bq25790_usb_work(struct work_struct *data) bc435a97ea513a3 Dan Murphy 2020-10-08 155 { bc435a97ea513a3 Dan Murphy 2020-10-08 156 struct bq25790_device *bq = bc435a97ea513a3 Dan Murphy 2020-10-08 157 container_of(data, struct bq25790_device, usb_work); bc435a97ea513a3 Dan Murphy 2020-10-08 158 bc435a97ea513a3 Dan Murphy 2020-10-08 159 switch (bq->usb_event) { bc435a97ea513a3 Dan Murphy 2020-10-08 160 case USB_EVENT_ID: bc435a97ea513a3 Dan Murphy 2020-10-08 161 break; bc435a97ea513a3 Dan Murphy 2020-10-08 162 bc435a97ea513a3 Dan Murphy 2020-10-08 163 case USB_EVENT_NONE: bc435a97ea513a3 Dan Murphy 2020-10-08 164 power_supply_changed(bq->charger); bc435a97ea513a3 Dan Murphy 2020-10-08 165 break; bc435a97ea513a3 Dan Murphy 2020-10-08 166 } bc435a97ea513a3 Dan Murphy 2020-10-08 167 bc435a97ea513a3 Dan Murphy 2020-10-08 168 return; ^^ bc435a97ea513a3 Dan Murphy 2020-10-08 169 bc435a97ea513a3 Dan Murphy 2020-10-08 @170 dev_err(bq->dev, "Error switching to charger mode.\n"); ^^ Unreachable. bc435a97ea513a3 Dan Murphy 2020-10-08 171 } The bitwise warning is this: if (state.fault_1 && (BQ25790_OTG_OVP | BQ25790_VSYS_OVP)) ^^ This && should be &. --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[tip:x86/seves 3/75] arch/x86/kvm/svm/nested.c:1153 svm_set_nested_state() error: uninitialized symbol 'save'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/seves head: 0ddfb1cf3b6b07c97cff16ea69931d986f9622ee commit: 6ccbd29ade0d159ee1be398dc9defaae567c253d [3/75] KVM: SVM: nested: Don't allocate VMCB structures on stack config: x86_64-randconfig-m001-20201008 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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: arch/x86/kvm/svm/nested.c:1153 svm_set_nested_state() error: uninitialized symbol 'save'. arch/x86/kvm/svm/nested.c:1154 svm_set_nested_state() error: uninitialized symbol 'ctl'. vim +/save +1153 arch/x86/kvm/svm/nested.c cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1055 static int svm_set_nested_state(struct kvm_vcpu *vcpu, cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1056 struct kvm_nested_state __user *user_kvm_nested_state, cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1057 struct kvm_nested_state *kvm_state) cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1058 { cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1059 struct vcpu_svm *svm = to_svm(vcpu); cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1060 struct vmcb *hsave = svm->nested.hsave; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1061 struct vmcb __user *user_vmcb = (struct vmcb __user *) cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1062 _kvm_nested_state->data.svm[0]; 6ccbd29ade0d159 Joerg Roedel 2020-09-07 1063 struct vmcb_control_area *ctl; 6ccbd29ade0d159 Joerg Roedel 2020-09-07 1064 struct vmcb_save_area *save; These aren't initialized. 6ccbd29ade0d159 Joerg Roedel 2020-09-07 1065 int ret; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1066 u32 cr0; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1067 6ccbd29ade0d159 Joerg Roedel 2020-09-07 1068 BUILD_BUG_ON(sizeof(struct vmcb_control_area) + sizeof(struct vmcb_save_area) > 6ccbd29ade0d159 Joerg Roedel 2020-09-07 1069 KVM_STATE_NESTED_SVM_VMCB_SIZE); 6ccbd29ade0d159 Joerg Roedel 2020-09-07 1070 cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1071 if (kvm_state->format != KVM_STATE_NESTED_FORMAT_SVM) cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1072 return -EINVAL; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1073 cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1074 if (kvm_state->flags & ~(KVM_STATE_NESTED_GUEST_MODE | cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1075 KVM_STATE_NESTED_RUN_PENDING | cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1076 KVM_STATE_NESTED_GIF_SET)) cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1077 return -EINVAL; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1078 cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1079 /* cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1080 * If in guest mode, vcpu->arch.efer actually refers to the L2 guest's cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1081 * EFER.SVME, but EFER.SVME still has to be 1 for VMRUN to succeed. cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1082 */ cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1083 if (!(vcpu->arch.efer & EFER_SVME)) { cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1084 /* GIF=1 and no guest mode are required if SVME=0. */ cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1085 if (kvm_state->flags != KVM_STATE_NESTED_GIF_SET) cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1086 return -EINVAL; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1087 } cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1088 cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1089 /* SMM temporarily disables SVM, so we cannot be in guest mode. */ cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1090 if (is_smm(vcpu) && (kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1091 return -EINVAL; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1092 cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1093 if (!(kvm_state->flags & KVM_STATE_NESTED_GUEST_MODE)) { cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1094 svm_leave_nested(svm); cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1095 goto out_set_gif; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1096 } cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1097 cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1098 if (!page_address_valid(vcpu, kvm_state->hdr.svm.vmcb_pa)) cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1099 return -EINVAL; cc440cdad5b7a4c Paolo Bonzini 2020-05-13 1100 if (kvm_state->size < sizeof(*kvm
Re: [PATCH v1 2/6] staging: qlge: coredump via devlink health reporter
On Thu, Oct 08, 2020 at 07:58:04PM +0800, Coiby Xu wrote: > -static int > -qlge_reporter_coredump(struct devlink_health_reporter *reporter, > - struct devlink_fmsg *fmsg, void *priv_ctx, > - struct netlink_ext_ack *extack) > +static int fill_seg_(struct devlink_fmsg *fmsg, > + struct mpi_coredump_segment_header *seg_header, > + u32 *reg_data) > { > - return 0; > + int i; > + int header_size = sizeof(struct mpi_coredump_segment_header); Please use the sizeof() directly in the code. Don't introduce indirection if you can help it. > + int regs_num = (seg_header->seg_size - header_size) / sizeof(u32); > + int err; > + regards, dan carpenter
Re: [PATCH v1 1/6] staging: qlge: Initialize devlink health dump framework for the dlge driver
100644 > index ..c91f7a29e805 > --- /dev/null > +++ b/drivers/staging/qlge/qlge_devlink.h > @@ -0,0 +1,8 @@ > +#ifndef QLGE_DEVLINK_H > +#define QLGE_DEVLINK_H > + > +#include > + > +int qlge_health_create_reporters(struct qlge_devlink *priv); > + > +#endif /* QLGE_DEVLINK_H */ > diff --git a/drivers/staging/qlge/qlge_main.c > b/drivers/staging/qlge/qlge_main.c > index 27da386f9d87..135225530e51 100644 > --- a/drivers/staging/qlge/qlge_main.c > +++ b/drivers/staging/qlge/qlge_main.c > @@ -42,6 +42,7 @@ > #include > > #include "qlge.h" > +#include "qlge_devlink.h" > > char qlge_driver_name[] = DRV_NAME; > const char qlge_driver_version[] = DRV_VERSION; > @@ -4549,6 +4550,8 @@ static void ql_timer(struct timer_list *t) > mod_timer(>timer, jiffies + (5 * HZ)); > } > > +static const struct devlink_ops qlge_devlink_ops; > + > static int qlge_probe(struct pci_dev *pdev, > const struct pci_device_id *pci_entry) > { > @@ -4556,6 +4559,13 @@ static int qlge_probe(struct pci_dev *pdev, > struct ql_adapter *qdev = NULL; > static int cards_found; > int err = 0; > + struct devlink *devlink; > + struct qlge_devlink *ql_devlink; > + > + devlink = devlink_alloc(_devlink_ops, sizeof(struct qlge_devlink)); > + if (!devlink) > + return -ENOMEM; > + ql_devlink = devlink_priv(devlink); > > ndev = alloc_etherdev_mq(sizeof(struct ql_adapter), >min(MAX_CPUS, > @@ -4614,6 +4624,16 @@ static int qlge_probe(struct pci_dev *pdev, > free_netdev(ndev); > return err; > } > + > + err = devlink_register(devlink, >dev); > + if (err) { > + goto devlink_free; > + } Checkpatch warning. regards, dan carpenter
Re: [PATCH 0/7] wfx: move out from the staging area
There are some static checker warnings to look at from linux-next from Tuesday. drivers/staging/wfx/hif_tx.c:319 hif_join() error: we previously assumed 'channel' could be null (see line 315) drivers/staging/wfx/main.c:228 wfx_send_pdata_pds() warn: potential NULL parameter dereference 'tmp_buf' drivers/staging/wfx/hif_rx.c:177 hif_scan_complete_indication() warn: potential NULL parameter dereference 'wvif' drivers/staging/wfx/data_tx.c:576 wfx_flush() warn: potential NULL parameter dereference 'wvif' drivers/staging/wfx/bus_spi.c:228 wfx_spi_probe() warn: 'bus->core' could be an error pointer drivers/staging/wfx/bus_sdio.c:221 wfx_sdio_probe() warn: 'bus->core' could be an error pointer drivers/staging/wfx/hif_rx.c:26 hif_generic_confirm() warn: negative user subtract: 0-u16max - 4 drivers/staging/wfx/hif_rx.c:98 hif_wakeup_indication() warn: 'gpiod_get_value(wdev->pdata.gpio_wakeup)' returns positive and negative drivers/staging/wfx/bh.c:24 device_wakeup() warn: 'gpiod_get_value_cansleep(wdev->pdata.gpio_wakeup)' returns positive and negative drivers/staging/wfx/hif_rx.c:235 hif_generic_indication() warn: format string contains non-ascii character '\xc2' drivers/staging/wfx/hif_rx.c:235 hif_generic_indication() warn: format string contains non-ascii character '\xb0' drivers/staging/wfx/data_tx.c:37 wfx_get_hw_rate() warn: constraint '(struct ieee80211_supported_band)->bitrates' overflow 'band->bitrates' 0 <= abs_rl '0-127' user_rl '' required = '(struct ieee80211_supported_band)->n_bitrates' Some of these are unpublished checks that I haven't published because they are too crap. The rest of the email is just long explanations. Skip if not required. regards, dan carpenter #1 drivers/staging/wfx/hif_tx.c:319 hif_join() error: we previously assumed 'channel' could be null (see line 315) 311 if (!hif) 312 return -ENOMEM; 313 body->infrastructure_bss_mode = !conf->ibss_joined; 314 body->short_preamble = conf->use_short_preamble; 315 if (channel && channel->flags & IEEE80211_CHAN_NO_IR) ^^^ Check for NULL. 316 body->probe_for_join = 0; 317 else 318 body->probe_for_join = 1; 319 body->channel_number = channel->hw_value; ^ Unchecked dereference. 320 body->beacon_interval = cpu_to_le32(conf->beacon_int); 321 body->basic_rate_set = #2 drivers/staging/wfx/main.c:228 wfx_send_pdata_pds() warn: potential NULL parameter dereference 'tmp_buf' 227 tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL); No check for allocation failure. 228 ret = wfx_send_pds(wdev, tmp_buf, pds->size); 229 kfree(tmp_buf); #3 drivers/staging/wfx/hif_rx.c:177 hif_scan_complete_indication() warn: potential NULL parameter dereference 'wvif' 170 static int hif_scan_complete_indication(struct wfx_dev *wdev, 171 const struct hif_msg *hif, 172 const void *buf) 173 { 174 struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); ^^^ Smatch thinks wdev_to_wvif() can return NULL. 175 176 WARN_ON(!wvif); 177 wfx_scan_complete(wvif); 178 179 return 0; 180 } #4 drivers/staging/wfx/data_tx.c:576 wfx_flush() warn: potential NULL parameter dereference 'wvif' 572 while ((skb = skb_dequeue()) != NULL) { 573 hif = (struct hif_msg *)skb->data; 574 wvif = wdev_to_wvif(wdev, hif->interface); ^ Same. 575 ieee80211_tx_info_clear_status(IEEE80211_SKB_CB(skb)); 576 wfx_skb_dtor(wvif, skb); 577 } 578 } #5 and #6 drivers/staging/wfx/bus_spi.c:228 wfx_spi_probe() warn: 'bus->core' could be an error pointer drivers/staging/wfx/bus_sdio.c:221 wfx_sdio_probe() warn: 'bus->core' could be an error pointer The wfx_init_common() function should return NULL instead of error pointer if devm_gpiod_get_optional() fails. #7 drivers/staging/wfx/hif_rx.c:26 hif_generic_confirm() warn: negative user subtract: 0-u16max - 4 20 static int hif_generic_confirm(struct wfx_dev *wdev, 21 const struct hif_msg *hif, const void *buf) 22 { 23 // All confirm messages start with status 24 int status = le32_to_cpup((__le32 *)buf); 25 int cmd = hif->id; 26 int len = le16_to_cpu(hif->len) - 4; // drop header Can "len" get set to negative 4? 27 28 WARN(!mutex_is_locked(>hif_cmd.lock), "
Re: [PATCH] PCI: fix a potential uninitentional integer overflow issue
On Wed, Oct 07, 2020 at 12:46:15PM +0100, Colin King wrote: > From: Colin Ian King > > The shift of 1 by align_order is evaluated using 32 bit arithmetic > and the result is assigned to a resource_size_t type variable that > is a 64 bit unsigned integer on 64 bit platforms. Fix an overflow > before widening issue by using the BIT_ULL macro to perform the > shift. > > Addresses-Coverity: ("Uninitentional integer overflow") > Fixes: 07d8d7e57c28 ("PCI: Make specifying PCI devices in kernel parameters > reusable") > Signed-off-by: Colin Ian King > --- > drivers/pci/pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index 6d4d5a2f923d..1a5844d7af35 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -6209,7 +6209,7 @@ static resource_size_t > pci_specified_resource_alignment(struct pci_dev *dev, > if (align_order == -1) > align = PAGE_SIZE; > else > - align = 1 << align_order; > + align = BIT_ULL(align_order); "align_order" comes from sscanf() so Smatch thinks it's not trusted. Anything above 63 is undefined behavior. There should be a bounds check on this but I don't know what the valid values of "align" are. regards, dan carpenter
[kbuild] Re: [PATCH] PCI: pciehp: Add check for DL_ACTIVE bit in pciehp_check_link_status()
Hi Sanjay, url: https://github.com/0day-ci/linux/commits/Sanjay-R-Mehta/PCI-pciehp-Add-check-for-DL_ACTIVE-bit-in-pciehp_check_link_status/20201007-022638 base:549738f15da0e5a00275977623be199fbbf7df50 config: x86_64-randconfig-m001-20201005 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/pci/hotplug/pciehp_hpc.c:313 pciehp_check_link_status() warn: maybe use && instead of & vim +313 drivers/pci/hotplug/pciehp_hpc.c 82a9e79ef132cbf Kenji Kaneshige 2009-09-15 290 int pciehp_check_link_status(struct controller *ctrl) ^1da177e4c3f415 Linus Torvalds2005-04-16 291 { cd84d34074f5659 Bjorn Helgaas 2013-05-09 292 struct pci_dev *pdev = ctrl_dev(ctrl); 1a84b99ccbb954c Bjorn Helgaas 2013-12-14 293 bool found; ^1da177e4c3f415 Linus Torvalds2005-04-16 294 u16 lnk_status; ^1da177e4c3f415 Linus Torvalds2005-04-16 295 f0157160b359b1d Keith Busch 2018-09-20 296 if (!pcie_wait_for_link(pdev, true)) f0157160b359b1d Keith Busch 2018-09-20 297 return -1; f18e9625e02bb3e Kenji Kaneshige 2008-10-22 298 f496648b99f8f7f Alexandru Gagniuc 2019-10-25 299 if (ctrl->inband_presence_disabled) f496648b99f8f7f Alexandru Gagniuc 2019-10-25 300 pcie_wait_for_presence(pdev); f496648b99f8f7f Alexandru Gagniuc 2019-10-25 301 2f5d8e4ff947ad6 Yinghai Lu2012-01-27 302 found = pci_bus_check_dev(ctrl->pcie->port->subordinate, 2f5d8e4ff947ad6 Yinghai Lu2012-01-27 303 PCI_DEVFN(0, 0)); 0027cb3e1947d0f Kenji Kaneshige 2011-11-10 304 6c35a1ac3da63a7 Lukas Wunner 2018-07-19 305 /* ignore link or presence changes up to this point */ 6c35a1ac3da63a7 Lukas Wunner 2018-07-19 306 if (found) 6c35a1ac3da63a7 Lukas Wunner 2018-07-19 307 atomic_and(~(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC), 6c35a1ac3da63a7 Lukas Wunner 2018-07-19 308 >pending_events); 6c35a1ac3da63a7 Lukas Wunner 2018-07-19 309 1a84b99ccbb954c Bjorn Helgaas 2013-12-14 310 pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, _status); 7f2feec140f1f1e Taku Izumi2008-09-05 311 ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); 818dc520d6f8472 Sanjay R Mehta2020-10-06 312 if (((lnk_status & PCI_EXP_LNKSTA_LT) & ^ This won't ever be true. PCI_EXP_LNKSTA_LT is 0x0800. It needs to be &&. 818dc520d6f8472 Sanjay R Mehta2020-10-06 @313!(lnk_status & PCI_EXP_DPC_CAP_DL_ACTIVE)) || 322162a71bd9fc4 Kenji Kaneshige 2008-12-19 314 !(lnk_status & PCI_EXP_LNKSTA_NLW)) { 3784e0c6b02d4fa Bjorn Helgaas 2015-06-15 315 ctrl_err(ctrl, "link training error: status %#06x\n", 3784e0c6b02d4fa Bjorn Helgaas 2015-06-15 316 lnk_status); 1a84b99ccbb954c Bjorn Helgaas 2013-12-14 317 return -1; ^1da177e4c3f415 Linus Torvalds2005-04-16 318 } ^1da177e4c3f415 Linus Torvalds2005-04-16 319 fdbd3ce9efb3a04 Yinghai Lu2011-11-07 320 pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status); fdbd3ce9efb3a04 Yinghai Lu2011-11-07 321 1a84b99ccbb954c Bjorn Helgaas 2013-12-14 322 if (!found) 1a84b99ccbb954c Bjorn Helgaas 2013-12-14 323 return -1; 2f5d8e4ff947ad6 Yinghai Lu2012-01-27 324 1a84b99ccbb954c Bjorn Helgaas 2013-12-14 325 return 0; ^1da177e4c3f415 Linus Torvalds2005-04-16 326 } --- 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 -- kbu...@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
drivers/net/ethernet/intel/ice/ice_main.c:789 ice_set_dflt_mib() warn: variable dereferenced before check 'pf' (see line 782)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 22fbc037cd32e4e6771d2271b565806cfb8c134c commit: 7d9c9b791f9e275b49870b6b10a1ea4d49209de8 ice: Implement LFC workaround config: x86_64-randconfig-m001-20201003 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/intel/ice/ice_main.c:789 ice_set_dflt_mib() warn: variable dereferenced before check 'pf' (see line 782) vim +/pf +789 drivers/net/ethernet/intel/ice/ice_main.c 7d9c9b791f9e275 Dave Ertman2020-07-13 780 static void ice_set_dflt_mib(struct ice_pf *pf) 7d9c9b791f9e275 Dave Ertman2020-07-13 781 { 7d9c9b791f9e275 Dave Ertman2020-07-13 @782 struct device *dev = ice_pf_to_dev(pf); ^^ Derferenced 7d9c9b791f9e275 Dave Ertman2020-07-13 783 u8 mib_type, *buf, *lldpmib = NULL; 7d9c9b791f9e275 Dave Ertman2020-07-13 784 u16 len, typelen, offset = 0; 7d9c9b791f9e275 Dave Ertman2020-07-13 785 struct ice_lldp_org_tlv *tlv; 7d9c9b791f9e275 Dave Ertman2020-07-13 786 struct ice_hw *hw; 7d9c9b791f9e275 Dave Ertman2020-07-13 787 u32 ouisubtype; 7d9c9b791f9e275 Dave Ertman2020-07-13 788 7d9c9b791f9e275 Dave Ertman2020-07-13 @789 if (!pf) { ^^^ Checked too late. 7d9c9b791f9e275 Dave Ertman2020-07-13 790 dev_dbg(dev, "%s NULL pf pointer\n", __func__); 7d9c9b791f9e275 Dave Ertman2020-07-13 791 return; 7d9c9b791f9e275 Dave Ertman2020-07-13 792 } 7d9c9b791f9e275 Dave Ertman2020-07-13 793 7d9c9b791f9e275 Dave Ertman2020-07-13 794 hw = >hw; 7d9c9b791f9e275 Dave Ertman2020-07-13 795 mib_type = SET_LOCAL_MIB_TYPE_LOCAL_MIB; 7d9c9b791f9e275 Dave Ertman2020-07-13 796 lldpmib = kzalloc(ICE_LLDPDU_SIZE, GFP_KERNEL); 7d9c9b791f9e275 Dave Ertman2020-07-13 797 if (!lldpmib) { --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH v3 7/7] dma-buf: system_heap: Add a system-uncached heap re-using the system heap
Hi John, url: https://github.com/0day-ci/linux/commits/John-Stultz/dma-buf-Performance-improvements-for-system-heap-a-system-uncached-implementation/20201003-120520 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bcf876870b95592b52519ed4aafcf9d95999bc9c config: i386-randconfig-m021-20201002 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/dma-buf/heaps/system_heap.c:496 system_heap_create() warn: passing zero to 'PTR_ERR' vim +/PTR_ERR +496 drivers/dma-buf/heaps/system_heap.c efa04fefebbd724 John Stultz 2019-12-03 478 static int system_heap_create(void) efa04fefebbd724 John Stultz 2019-12-03 479 { efa04fefebbd724 John Stultz 2019-12-03 480 struct dma_heap_export_info exp_info; efa04fefebbd724 John Stultz 2019-12-03 481 263e38f82cbb35b Andrew F. Davis 2019-12-16 482 exp_info.name = "system"; efa04fefebbd724 John Stultz 2019-12-03 483 exp_info.ops = _heap_ops; efa04fefebbd724 John Stultz 2019-12-03 484 exp_info.priv = NULL; efa04fefebbd724 John Stultz 2019-12-03 485 efa04fefebbd724 John Stultz 2019-12-03 486 sys_heap = dma_heap_add(_info); efa04fefebbd724 John Stultz 2019-12-03 487 if (IS_ERR(sys_heap)) a2e10cdd2e4d12a John Stultz 2020-10-03 488 return PTR_ERR(sys_heap); efa04fefebbd724 John Stultz 2019-12-03 489 553f4e0fafc5b3b John Stultz 2020-10-03 490 exp_info.name = "system-uncached"; 553f4e0fafc5b3b John Stultz 2020-10-03 491 exp_info.ops = _uncached_heap_ops; 553f4e0fafc5b3b John Stultz 2020-10-03 492 exp_info.priv = NULL; 553f4e0fafc5b3b John Stultz 2020-10-03 493 553f4e0fafc5b3b John Stultz 2020-10-03 494 sys_uncached_heap = dma_heap_add(_info); 553f4e0fafc5b3b John Stultz 2020-10-03 495 if (IS_ERR(sys_uncached_heap)) 553f4e0fafc5b3b John Stultz 2020-10-03 @496 return PTR_ERR(sys_heap); ^ This should be return PTR_ERR(sys_uncached_heap); --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:5638 bnx2x_link_settings_status() warn: signedness bug returning '(-22)'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: d3d45f8220d60a0b2cf8fb2be4e6ffd9008e commit: 2c855d73f2f6107f5b8ebc45f8b934bf7f4419e0 bnx2x: Remove read_status_t function casts config: x86_64-randconfig-m001-20201003 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/broadcom/bnx2x/bnx2x_link.c:5638 bnx2x_link_settings_status() warn: signedness bug returning '(-22)' Old smatch warnings: drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c:7184 bnx2x_8073_8727_external_rom_boot() error: uninitialized symbol 'fw_ver1'. vim +5638 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c 2c855d73f2f6107 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c Kees Cook 2019-11-14 5614 static u8 bnx2x_link_settings_status(struct bnx2x_phy *phy, ^^ 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5615 struct link_params *params, 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5616 struct link_vars *vars) 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5617 { 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5618 struct bnx2x *bp = params->bp; 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5619 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5620 u16 gp_status, duplex = DUPLEX_HALF, link_up = 0, speed_mask; 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5621 int rc = 0; 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5622 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5623 /* Read gp_status */ 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5624 CL22_RD_OVER_CL45(bp, phy, 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5625MDIO_REG_BANK_GP_STATUS, 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5626MDIO_GP_STATUS_TOP_AN_STATUS1, 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5627_status); 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5628 if (gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_DUPLEX_STATUS) 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5629 duplex = DUPLEX_FULL; 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5630 if (gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_LINK_STATUS) 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5631 link_up = 1; 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5632 speed_mask = gp_status & GP_STATUS_SPEED_MASK; 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5633 DP(NETIF_MSG_LINK, "gp_status 0x%x, is_link_up %d, speed_mask 0x%x\n", 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5634 gp_status, link_up, speed_mask); 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5635 rc = bnx2x_get_link_speed_duplex(phy, params, vars, link_up, speed_mask, 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5636 duplex); 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5637 if (rc == -EINVAL) 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 @5638 return rc; ^^ return -EINVAL gets truncated to a u8. 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5639 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c Yaniv Rosner 2011-06-14 5640 if (gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_LINK_STATUS) { 3c9ada227c56c6f drivers/net/bnx2x/bnx2x_link.c
Re: [PATCH v2 2/3] Input: Add Novatek NT36xxx touchscreen driver
Hi, Thank you for the patch! Perhaps something to improve: url: https://github.com/0day-ci/linux/commits/kholk11-gmail-com/Add-Novatek-NT36xxx-touchscreen-driver/20200927-203756 base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next config: i386-randconfig-m021-20201003 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/input/touchscreen/nt36xxx.c:470 nt36xxx_i2c_chip_version_init() warn: calling memset(x, y, ARRAY_SIZE()); vim +470 drivers/input/touchscreen/nt36xxx.c 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 443 static int nt36xxx_i2c_chip_version_init(struct nt36xxx_i2c *ts) 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 444 { 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 445 u8 buf[7] = { 0 }; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 446 int retry = NT36XXX_MAX_RETRIES; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 447 int sz = sizeof(trim_id_table) / sizeof(struct nt36xxx_trim_table); 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 448 int i, list, mapid, ret; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 449 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 450 ret = nt36xxx_bootloader_reset(ts); 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 451 if (ret < 0) { 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 452 dev_err(>client->dev, "Can't reset the nvt IC\n"); 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 453 return ret; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 454 } 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 455 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 456 do { 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 457 ret = nt36xxx_sw_reset_idle(ts); 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 458 if (ret < 0) 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 459 continue; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 460 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 461 buf[0] = 0x00; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 462 buf[1] = NT36XXX_CMD_UNLOCK; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 463 nt36xxx_write(ts->client, ts->client->addr, buf, 2); 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 464 usleep_range(1, 11000); 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 465 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 466 ret = nt36xxx_set_page(ts, NT36XXX_PAGE_CHIP_INFO); 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 467 if (ret < 0) 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 468 continue; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 469 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 @470 memset(buf, 0, ARRAY_SIZE(buf)); memset() should always zero the number of bytes (sizeof(buf)), not the number of elements (ARRAY_SIZE(buf)). For u8, of course, the elements are byte size so it's the same. But if someone uses `grep -w memset $(git ls-files) | grep ARRAY_SIZE` then this will show up as improper code. 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 471 buf[0] = NT36XXX_EVT_CHIPID; 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 472 nt36xxx_read(ts->client, NT36XXX_BLDR_ADDR, buf, 7); 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 473 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 474 /* Compare read chip id with trim list */ 6375d650f6f53aa AngeloGioacchino Del Regno 2020-09-27 475 for (list = 0; list < sz; list++) { --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH][next] net: phy: dp83869: fix unsigned comparisons against less than zero values
On Fri, Oct 02, 2020 at 12:26:49PM -0500, Dan Murphy wrote: > Colin > > On 10/2/20 11:54 AM, Colin King wrote: > > From: Colin Ian King > > > > Currently the comparisons of u16 integers value and sopass_val with > > less than zero for error checking is always false because the values > > are unsigned. Fix this by making these variables int. This does not > > affect the shift and mask operations performed on these variables > > > > Addresses-Coverity: ("Unsigned compared against zero") > > Fixes: 49fc23018ec6 ("net: phy: dp83869: support Wake on LAN") > > Signed-off-by: Colin Ian King > > --- > > drivers/net/phy/dp83869.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c > > index 0aee5f645b71..cf6dec7b7d8e 100644 > > --- a/drivers/net/phy/dp83869.c > > +++ b/drivers/net/phy/dp83869.c > > @@ -305,7 +305,7 @@ static int dp83869_set_wol(struct phy_device *phydev, > > static void dp83869_get_wol(struct phy_device *phydev, > > struct ethtool_wolinfo *wol) > > { > > - u16 value, sopass_val; > > + int value, sopass_val; > > wol->supported = (WAKE_UCAST | WAKE_BCAST | WAKE_MAGIC | > > WAKE_MAGICSECURE); > > Wonder why this was not reported before as the previous comparison issue > reported by zero day. It was reported on Sep 25. I forward those zero day bot emails. https://lore.kernel.org/lkml/20200925123858.GX18329@kadam/ regards, dan carpenter
Re: [PATCH 2/2] media: staging: atomisp: Removed else branch in function
On Tue, Oct 06, 2020 at 10:17:21AM +0200, Leonid Kushnir wrote: > This patch fixes the checkpatch.pl warning : > > WARNING: else is not generally useful after a break or return > > Expressions under 'else' branch in function 'gc0310_s_power' are > executed whenever the exppression in 'if' is False. Otherwise, return > from function occurs. Therefore, there is no need in 'else', and it has > been removed. > > Signed-off-by: Leonid Kushnir > --- > drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 9 - > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c > b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c > index 6be3ee1d93a5..8201c15b5769 100644 > --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c > +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c > @@ -874,11 +874,10 @@ static int gc0310_s_power(struct v4l2_subdev *sd, int > on) > > if (on == 0) > return power_down(sd); > - else { > - ret = power_up(sd); > - if (!ret) > - return gc0310_init(sd); > - } > + ret = power_up(sd); > + if (!ret) Flip this check around as well. > + return gc0310_init(sd); > + > return ret; Code should generally do "error handling" instead of "success handling". That way the success path is always indented one tab and the error path is indented two tabs. I like to say that the call and the error handling are part of the same thing, but with success handling, it's like do the call, do more stuff, go back to the error handling from the earlier call. Anyway, TLDR, please write it like this: if (on == 0) return power_down(sd); ret = power_up(sd); if (ret) return ret; return gc0310_init(sd); regards, dan carpenter
Re: [PATCH][next] power: supply: bq25980: remove redundant zero check on ret
On Tue, Oct 06, 2020 at 06:06:00PM +0100, Colin King wrote: > From: Colin Ian King > > Currently ret is assigned to zero and the following statement checks > if it is non-zero. This check is redundant and can be removed > > Addresses-Coverity: ("Logically dead code") > Fixes: 5069185fc18e ("power: supply: bq25980: Add support for the BQ259xx > family") > Signed-off-by: Colin Ian King > --- > drivers/power/supply/bq25980_charger.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/power/supply/bq25980_charger.c > b/drivers/power/supply/bq25980_charger.c > index 3995fb7cf060..f04f9acdb13b 100644 > --- a/drivers/power/supply/bq25980_charger.c > +++ b/drivers/power/supply/bq25980_charger.c > @@ -613,9 +613,6 @@ static int bq25980_set_battery_property(struct > power_supply *psy, > struct bq25980_device *bq = power_supply_get_drvdata(psy); > int ret = 0; I'm surprised this doesn't generate a set but not used warning. And then at the end of the function it could be changed from "return ret;" to "return 0;" regards, dan carpenter
drivers/gpu/drm/vboxvideo/vbox_main.c:146 vbox_hw_init() warn: 'vbox->guest_heap' not released on lines: 126.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 472e5b056f000a778abb41f1e443de58eb259783 commit: 8558de401b5fbbfb1df96d6986bba3c79cd47401 drm/vboxvideo: use managed pci functions config: i386-randconfig-m021-20201002 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/vboxvideo/vbox_main.c:146 vbox_hw_init() warn: 'vbox->guest_heap' not released on lines: 126. vim +146 drivers/gpu/drm/vboxvideo/vbox_main.c d46709094deb69 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2018-09-18 107 int vbox_hw_init(struct vbox_private *vbox) dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 108 { dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 109 int ret = -ENOMEM; dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 110 dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 111 vbox->full_vram_size = inl(VBE_DISPI_IOPORT_DATA); dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 112 vbox->any_pitch = vbox_check_supported(VBE_DISPI_ID_ANYX); dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 113 dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 114 DRM_INFO("VRAM %08x\n", vbox->full_vram_size); dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 115 dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 116 /* Map guest-heap at end of vram */ dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 117 vbox->guest_heap = 01648890f336a3 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2018-09-18 118 pci_iomap_range(vbox->ddev.pdev, 0, GUEST_HEAP_OFFSET(vbox), dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 119 GUEST_HEAP_SIZE); dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 120 if (!vbox->guest_heap) dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 121 return -ENOMEM; dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 122 dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 123 /* Create guest-heap mem-pool use 2^4 = 16 byte chunks */ dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 124 vbox->guest_pool = gen_pool_create(4, -1); dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 125 if (!vbox->guest_pool) 8558de401b5fbb drivers/gpu/drm/vboxvideo/vbox_main.c Daniel Vetter 2020-04-15 126 return -ENOMEM; Need to unmap vbox->guest_heap on error. Probably all error paths? dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 127 dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 128 ret = gen_pool_add_virt(vbox->guest_pool, dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 129 (unsigned long)vbox->guest_heap, dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 130 GUEST_HEAP_OFFSET(vbox), dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 131 GUEST_HEAP_USABLE_SIZE, -1); dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 132 if (ret) dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 133 goto err_destroy_guest_pool; dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 134 dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 135 ret = hgsmi_test_query_conf(vbox->guest_pool); dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 136 if (ret) { dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 137 DRM_ERROR("vboxvideo: hgsmi_test_query_conf failed\n"); dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 138 goto err_destroy_guest_pool; dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 139 } dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 140 dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 141 /* Reduce available VRAM size to reflect the guest heap. */ dd55d44f408419 drivers/staging/vboxvideo/vbox_main.c Hans de Goede 2017-07-06 142 vbox->available_vram_
drivers/net/ethernet/intel/i40e/i40e_debugfs.c:582 i40e_dbg_dump_desc() error: uninitialized symbol 'ring'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 60e720931556fc1034d0981460164dcf02697679 commit: 44ea803e2fa7e12adb5d6260da4e4956e784effb i40e: introduce new dump desc XDP command config: i386-randconfig-m021-20201001 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/intel/i40e/i40e_debugfs.c:582 i40e_dbg_dump_desc() error: uninitialized symbol 'ring'. vim +/ring +582 drivers/net/ethernet/intel/i40e/i40e_debugfs.c 02e9c290814cc14 Jesse Brandeburg 2013-09-11 541 static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, 44ea803e2fa7e12 Ciara Loftus 2020-06-23 542 struct i40e_pf *pf, enum ring_type type) 02e9c290814cc14 Jesse Brandeburg 2013-09-11 543 { 44ea803e2fa7e12 Ciara Loftus 2020-06-23 544bool is_rx_ring = type == RING_TYPE_RX; 68bf94aae1873cb Shannon Nelson 2014-01-15 545struct i40e_tx_desc *txd; 68bf94aae1873cb Shannon Nelson 2014-01-15 546union i40e_rx_desc *rxd; e6c97234d1b18d4 Joe Perches 2014-11-18 547struct i40e_ring *ring; 02e9c290814cc14 Jesse Brandeburg 2013-09-11 548struct i40e_vsi *vsi; 02e9c290814cc14 Jesse Brandeburg 2013-09-11 549int i; 02e9c290814cc14 Jesse Brandeburg 2013-09-11 550 02e9c290814cc14 Jesse Brandeburg 2013-09-11 551vsi = i40e_dbg_find_vsi(pf, vsi_seid); 02e9c290814cc14 Jesse Brandeburg 2013-09-11 552if (!vsi) { 7792fe4fd2f1fac Shannon Nelson 2013-11-26 553 dev_info(>pdev->dev, "vsi %d not found\n", vsi_seid); 02e9c290814cc14 Jesse Brandeburg 2013-09-11 554return; 02e9c290814cc14 Jesse Brandeburg 2013-09-11 555} 44ea803e2fa7e12 Ciara Loftus 2020-06-23 556if (type == RING_TYPE_XDP && !i40e_enabled_xdp_vsi(vsi)) { 44ea803e2fa7e12 Ciara Loftus 2020-06-23 557 dev_info(>pdev->dev, "XDP not enabled on VSI %d\n", vsi_seid); 44ea803e2fa7e12 Ciara Loftus 2020-06-23 558return; 44ea803e2fa7e12 Ciara Loftus 2020-06-23 559} 02e9c290814cc14 Jesse Brandeburg 2013-09-11 560if (ring_id >= vsi->num_queue_pairs || ring_id < 0) { 02e9c290814cc14 Jesse Brandeburg 2013-09-11 561 dev_info(>pdev->dev, "ring %d not found\n", ring_id); 02e9c290814cc14 Jesse Brandeburg 2013-09-11 562return; 02e9c290814cc14 Jesse Brandeburg 2013-09-11 563} 68bf94aae1873cb Shannon Nelson 2014-01-15 564if (!vsi->tx_rings || !vsi->tx_rings[0]->desc) { 29d0790ef3acd86 Shannon Nelson 2013-11-26 565 dev_info(>pdev->dev, 29d0790ef3acd86 Shannon Nelson 2013-11-26 566 "descriptor rings have not been allocated for vsi %d\n", 29d0790ef3acd86 Shannon Nelson 2013-11-26 567 vsi_seid); 29d0790ef3acd86 Shannon Nelson 2013-11-26 568return; 29d0790ef3acd86 Shannon Nelson 2013-11-26 569} e6c97234d1b18d4 Joe Perches 2014-11-18 570 44ea803e2fa7e12 Ciara Loftus 2020-06-23 571switch (type) { 44ea803e2fa7e12 Ciara Loftus 2020-06-23 572case RING_TYPE_RX: 44ea803e2fa7e12 Ciara Loftus 2020-06-23 573ring = kmemdup(vsi->rx_rings[ring_id], sizeof(*ring), GFP_KERNEL); 44ea803e2fa7e12 Ciara Loftus 2020-06-23 574break; 44ea803e2fa7e12 Ciara Loftus 2020-06-23 575case RING_TYPE_TX: 44ea803e2fa7e12 Ciara Loftus 2020-06-23 576ring = kmemdup(vsi->tx_rings[ring_id], sizeof(*ring), GFP_KERNEL); 44ea803e2fa7e12 Ciara Loftus 2020-06-23 577break; 44ea803e2fa7e12 Ciara Loftus 2020-06-23 578case RING_TYPE_XDP: 44ea803e2fa7e12 Ciara Loftus 2020-06-23 579ring = kmemdup(vsi->xdp_rings[ring_id], sizeof(*ring), GFP_KERNEL); 44ea803e2fa7e12 Ciara Loftus 2020-06-23 580break; Add default case? 44ea803e2fa7e12 Ciara Loftus 2020-06-23 581} e6c97234d1b18d4 Joe Perches 2014-11-18 @582if (!ring) ^ e6c97234d1b18d4 Joe Perches 2014-11-18 583return; e6c97234d1b18d4 Joe Perches 2014-11-18 584 02e9c290814cc14 Jesse Brandeburg 2013-09-11 585if (cnt == 2) { 44ea803e2fa7e12 Ciara Loftus 2020-06-23 586switch (type) { 44ea803e2fa7e12 Ciara Loftus 2020-06-23 587case RING_TYPE_RX: --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
Re: [PATCH 00/18] use semicolons rather than commas to separate statements
On Tue, Sep 29, 2020 at 02:20:00PM +0200, Ard Biesheuvel wrote: > On Sun, 27 Sep 2020 at 21:56, Julia Lawall wrote: > > > > These patches replace commas by semicolons. > > > Why? > In the best case, these commas are just uninitentional mess, like typing an extra space character or something. I've looked at them before and one case I see where they are introduced is when people convert a struct initializer to code. - struct foo { - .a = 1, - .b = 2, ... + foo.a = 1, + foo.b = 2, The times where commas are used deliberately to replace curly braces are just evil. Either way the code is cleaner with semi-colons. regards, dan carpenter
Re: [PATCH] staging: mfd: hi6421-spmi-pmic: Fix error return in hi6421_spmi_pmic_probe()
On Tue, Sep 29, 2020 at 03:48:47PM +0800, Jing Xiangfeng wrote: > Fix to return error code -ENOMEM from the error handling case instead > of 0. > > Signed-off-by: Jing Xiangfeng > --- > drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c > b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c > index 64b30d263c8d..4f34a5282970 100644 > --- a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c > +++ b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c > @@ -262,8 +262,10 @@ static int hi6421_spmi_pmic_probe(struct spmi_device > *pdev) > hi6421_spmi_pmic_irq_prc(pmic); > > pmic->irqs = devm_kzalloc(dev, HISI_IRQ_NUM * sizeof(int), GFP_KERNEL); > - if (!pmic->irqs) > + if (!pmic->irqs) { > + ret = -ENOMEM; > goto irq_malloc; It shouldn't do a goto, it should just return directly. The goto releases an IRQ which isn't acquired until later in the function. regards, dan carpenter
Re: [PATCH] media: atomisp: Fixed error handling path
On Tue, Sep 29, 2020 at 07:34:39AM +0530, Souptick Joarder wrote: > Hi Dan, > > > On Mon, Sep 28, 2020 at 2:08 PM Dan Carpenter > wrote: > > > > On Sun, Sep 27, 2020 at 08:38:04PM +0530, Souptick Joarder wrote: > > > Inside alloc_user_pages() based on flag value either pin_user_pages() > > > or get_user_pages_fast() will be called. However, these API might fail. > > > > > > But free_user_pages() called in error handling path doesn't bother > > > about return value and will try to unpin bo->pgnr pages, which is > > > incorrect. > > > > > > Fix this by passing the page_nr to free_user_pages(). If page_nr > 0 > > > pages will be unpinned based on bo->mem_type. This will also take care > > > of non error handling path. > > > > > > Fixes: 14a638ab96c5 ("media: atomisp: use pin_user_pages() for memory > > > allocation") > > > Signed-off-by: Souptick Joarder > > > Cc: John Hubbard > > > Cc: Ira Weiny > > > Cc: Dan Carpenter > > > --- > > > drivers/staging/media/atomisp/pci/hmm/hmm_bo.c | 13 - > > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > > > diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c > > > b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c > > > index f13af23..0168f98 100644 > > > --- a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c > > > +++ b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c > > > @@ -857,16 +857,17 @@ static void free_private_pages(struct > > > hmm_buffer_object *bo, > > > kfree(bo->page_obj); > > > } > > > > > > -static void free_user_pages(struct hmm_buffer_object *bo) > > > +static void free_user_pages(struct hmm_buffer_object *bo, > > > + unsigned int page_nr) > > > { > > > int i; > > > > > > hmm_mem_stat.usr_size -= bo->pgnr; > > ^^^ > > This is still a problem. It needs to be hmm_mem_stat.usr_size -= page_nr. > > In failure path, it is hmm_mem_stat.usr_size += bo->pgnr. > I think, hmm_mem_stat.usr_size -= bo->pgnr is correct as per existing code. > Do you think that needs to be changed ? > Yeah. Crud. I'm sorry. You had it right. Reviewed-by: Dan Carpenter regards, dan carpenter
Re: [PATCH] staging: most: don't access hdm_ch before checking it valid
On Mon, Sep 28, 2020 at 06:48:38PM +0800, Jing Xiangfeng wrote: > In try_start_dim_transfer(), pointer hdm_ch is accessed before checking. > This may lead to a potential null pointer dereference. Fix this by > dereferencing hdm_ch after calling BUG_ON(). > > Signed-off-by: Jing Xiangfeng > --- > drivers/staging/most/dim2/dim2.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/most/dim2/dim2.c > b/drivers/staging/most/dim2/dim2.c > index 509c8012d20b..ccd7cc7545e4 100644 > --- a/drivers/staging/most/dim2/dim2.c > +++ b/drivers/staging/most/dim2/dim2.c > @@ -148,7 +148,7 @@ void dimcb_on_error(u8 error_id, const char > *error_message) > static int try_start_dim_transfer(struct hdm_channel *hdm_ch) > { > u16 buf_size; > - struct list_head *head = _ch->pending_list; This is not a dereference, it's just pointer math. In other words: struct list_head *head = hdm_ch + offsetof(struct hdm_channel, pending_list); So the commit message is wrong because this cannot lead to a NULL dereference. It's better to just delete the BUG_ON(). We don't really like BUG_ON(). Checkpatch will complain about them. An Oops gives basically the same information as a BUG_ON() without completely killing the kernel so just dereferencing a NULL is preferable. Finally, we can see from the callers that "hdm_ch" is never NULL. regards, dan carpenter
[PATCH] scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs()
The be_fill_queue() function can only fail when "eq_vaddress" is NULL and since it's non-NULL here that means the function call can't fail. But imagine if it could, then in that situation we would want to store the "paddr" so that dma memory can be released. Fixes: bfead3b2cb46 ("[SCSI] be2iscsi: Adding msix and mcc_rings V3") Signed-off-by: Dan Carpenter --- drivers/scsi/be2iscsi/be_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 5c3513a4b450..202ba925c494 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -3020,6 +3020,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, goto create_eq_error; } + mem->dma = paddr; mem->va = eq_vaddress; ret = be_fill_queue(eq, phba->params.num_eq_entries, sizeof(struct be_eq_entry), eq_vaddress); @@ -3029,7 +3030,6 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, goto create_eq_error; } - mem->dma = paddr; ret = beiscsi_cmd_eq_create(>ctrl, eq, BEISCSI_EQ_DELAY_DEF); if (ret) { @@ -3086,6 +3086,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, goto create_cq_error; } + mem->dma = paddr; ret = be_fill_queue(cq, phba->params.num_cq_entries, sizeof(struct sol_cqe), cq_vaddress); if (ret) { @@ -3095,7 +3096,6 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, goto create_cq_error; } - mem->dma = paddr; ret = beiscsi_cmd_cq_create(>ctrl, cq, eq, false, false, 0); if (ret) { -- 2.28.0
Re: [PATCH] media: atomisp: Fixed error handling path
On Sun, Sep 27, 2020 at 08:38:04PM +0530, Souptick Joarder wrote: > Inside alloc_user_pages() based on flag value either pin_user_pages() > or get_user_pages_fast() will be called. However, these API might fail. > > But free_user_pages() called in error handling path doesn't bother > about return value and will try to unpin bo->pgnr pages, which is > incorrect. > > Fix this by passing the page_nr to free_user_pages(). If page_nr > 0 > pages will be unpinned based on bo->mem_type. This will also take care > of non error handling path. > > Fixes: 14a638ab96c5 ("media: atomisp: use pin_user_pages() for memory > allocation") > Signed-off-by: Souptick Joarder > Cc: John Hubbard > Cc: Ira Weiny > Cc: Dan Carpenter > --- > drivers/staging/media/atomisp/pci/hmm/hmm_bo.c | 13 - > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c > b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c > index f13af23..0168f98 100644 > --- a/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c > +++ b/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c > @@ -857,16 +857,17 @@ static void free_private_pages(struct hmm_buffer_object > *bo, > kfree(bo->page_obj); > } > > -static void free_user_pages(struct hmm_buffer_object *bo) > +static void free_user_pages(struct hmm_buffer_object *bo, > + unsigned int page_nr) > { > int i; > > hmm_mem_stat.usr_size -= bo->pgnr; ^^^ This is still a problem. It needs to be hmm_mem_stat.usr_size -= page_nr. regards, dan carpenter > > if (bo->mem_type == HMM_BO_MEM_TYPE_PFN) { > - unpin_user_pages(bo->pages, bo->pgnr); > + unpin_user_pages(bo->pages, page_nr); > } else { > - for (i = 0; i < bo->pgnr; i++) > + for (i = 0; i < page_nr; i++) > put_page(bo->pages[i]); > } > kfree(bo->pages);
drivers/phy/mediatek/phy-mtk-tphy.c:955 mtk_phy_init() warn: 'instance->da_ref_clk' not released on lines: 952.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: b463b6f69974867b3b5885de2f488d72e979a751 commit: 12d0c0bed3f473523fbb66db59db7d79982c0aff phy: phy-mtk-tphy: add a new reference clock config: arm64-randconfig-m031-20200925 (attached as .config) compiler: aarch64-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 New smatch warnings: drivers/phy/mediatek/phy-mtk-tphy.c:955 mtk_phy_init() warn: 'instance->da_ref_clk' not released on lines: 952. Old smatch warnings: drivers/phy/mediatek/phy-mtk-tphy.c:955 mtk_phy_init() warn: 'instance->ref_clk' not released on lines: 952. vim +955 drivers/phy/mediatek/phy-mtk-tphy.c 8158e917d91cb0b drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2018-06-29 916 cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 917 static int mtk_phy_init(struct phy *phy) dc7f190fd51f5c6 drivers/phy/phy-mt65xx-usb3.c Chunfeng Yun 2015-09-29 918 { cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 919struct mtk_phy_instance *instance = phy_get_drvdata(phy); cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 920struct mtk_tphy *tphy = dev_get_drvdata(phy->dev.parent); dc7f190fd51f5c6 drivers/phy/phy-mt65xx-usb3.c Chunfeng Yun 2015-09-29 921int ret; dc7f190fd51f5c6 drivers/phy/phy-mt65xx-usb3.c Chunfeng Yun 2015-09-29 922 15de15c6b45b87a drivers/phy/phy-mt65xx-usb3.c Chunfeng Yun 2017-03-31 923ret = clk_prepare_enable(instance->ref_clk); 15de15c6b45b87a drivers/phy/phy-mt65xx-usb3.c Chunfeng Yun 2017-03-31 924if (ret) { cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 925dev_err(tphy->dev, "failed to enable ref_clk\n"); 15de15c6b45b87a drivers/phy/phy-mt65xx-usb3.c Chunfeng Yun 2017-03-31 926return ret; 15de15c6b45b87a drivers/phy/phy-mt65xx-usb3.c Chunfeng Yun 2017-03-31 927} 15de15c6b45b87a drivers/phy/phy-mt65xx-usb3.c Chunfeng Yun 2017-03-31 928 12d0c0bed3f4735 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2020-02-11 929ret = clk_prepare_enable(instance->da_ref_clk); 12d0c0bed3f4735 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2020-02-11 930if (ret) { 12d0c0bed3f4735 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2020-02-11 931dev_err(tphy->dev, "failed to enable da_ref\n"); 12d0c0bed3f4735 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2020-02-11 932clk_disable_unprepare(instance->ref_clk); 12d0c0bed3f4735 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2020-02-11 933return ret; 12d0c0bed3f4735 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2020-02-11 934} 12d0c0bed3f4735 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2020-02-11 935 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 936switch (instance->type) { 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 937case PHY_TYPE_USB2: cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 938u2_phy_instance_init(tphy, instance); 8158e917d91cb0b drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2018-06-29 939u2_phy_props_set(tphy, instance); 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 940break; 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 941case PHY_TYPE_USB3: cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 942u3_phy_instance_init(tphy, instance); 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 943break; 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 944case PHY_TYPE_PCIE: cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 945pcie_phy_instance_init(tphy, instance); 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 946break; 4ab26cb66a8cb3c drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 947case PHY_TYPE_SATA: cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 948sata_phy_instance_init(tphy, instance); 4ab26cb66a8cb3c drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 949break; 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3.c Ryder Lee2017-08-03 950default: cd4ec4b03dc15b1 drivers/phy/mediatek/phy-mtk-tphy.c Chunfeng Yun 2017-08-03 951dev_err(tphy->dev, "incompatible PHY type\n"); 44a6d6ce6436a2b drivers/phy/phy-mt65xx-usb3
[PATCH v3] mm/hmm/test: use after free in dmirror_allocate_chunk()
The error handling code does this: err_free: kfree(devmem); ^ err_release: release_mem_region(devmem->pagemap.range.start, range_len(>pagemap.range)); The problem is that when we use "devmem->pagemap.range.start" the "devmem" pointer is either NULL or freed. Neither the allocation nor the call to request_free_mem_region() has to be done under the lock so I moved those to the start of the function. Fixes: 1f9c4bb986d9 ("mm/memremap_pages: convert to 'struct range'") Signed-off-by: Dan Carpenter Reviewed-by: Ralph Campbell --- v2: The first version introduced a locking bug v3: Markus Elfring pointed out that the Fixes tag was wrong. This bug was in the original commit and then fixed and then re-introduced. I was quite bothered by how this bug lasted so long in the source code, but now we know. As soon as it is introduced we fixed it. One problem with the kernel QC process is that I think everyone marks the bug as "old/dealt with" so it was only because I was added a new check for resource leaks that it was found when it was re-introduced. lib/test_hmm.c | 44 ++-- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c index c8133f50160b..e151a7f10519 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -459,6 +459,22 @@ static bool dmirror_allocate_chunk(struct dmirror_device *mdevice, unsigned long pfn_last; void *ptr; + devmem = kzalloc(sizeof(*devmem), GFP_KERNEL); + if (!devmem) + return -ENOMEM; + + res = request_free_mem_region(_resource, DEVMEM_CHUNK_SIZE, + "hmm_dmirror"); + if (IS_ERR(res)) + goto err_devmem; + + devmem->pagemap.type = MEMORY_DEVICE_PRIVATE; + devmem->pagemap.range.start = res->start; + devmem->pagemap.range.end = res->end; + devmem->pagemap.nr_range = 1; + devmem->pagemap.ops = _devmem_ops; + devmem->pagemap.owner = mdevice; + mutex_lock(>devmem_lock); if (mdevice->devmem_count == mdevice->devmem_capacity) { @@ -471,30 +487,14 @@ static bool dmirror_allocate_chunk(struct dmirror_device *mdevice, sizeof(new_chunks[0]) * new_capacity, GFP_KERNEL); if (!new_chunks) - goto err; + goto err_release; mdevice->devmem_capacity = new_capacity; mdevice->devmem_chunks = new_chunks; } - res = request_free_mem_region(_resource, DEVMEM_CHUNK_SIZE, - "hmm_dmirror"); - if (IS_ERR(res)) - goto err; - - devmem = kzalloc(sizeof(*devmem), GFP_KERNEL); - if (!devmem) - goto err_release; - - devmem->pagemap.type = MEMORY_DEVICE_PRIVATE; - devmem->pagemap.range.start = res->start; - devmem->pagemap.range.end = res->end; - devmem->pagemap.nr_range = 1; - devmem->pagemap.ops = _devmem_ops; - devmem->pagemap.owner = mdevice; - ptr = memremap_pages(>pagemap, numa_node_id()); if (IS_ERR(ptr)) - goto err_free; + goto err_release; devmem->mdevice = mdevice; pfn_first = devmem->pagemap.range.start >> PAGE_SHIFT; @@ -525,12 +525,12 @@ static bool dmirror_allocate_chunk(struct dmirror_device *mdevice, return true; -err_free: - kfree(devmem); err_release: - release_mem_region(devmem->pagemap.range.start, range_len(>pagemap.range)); -err: mutex_unlock(>devmem_lock); + release_mem_region(devmem->pagemap.range.start, range_len(>pagemap.range)); +err_devmem: + kfree(devmem); + return false; } -- 2.28.0
[kbuild] Re: [PATCH net-next v4 1/2] net: phy: dp83869: support Wake on LAN
Hi Dan, url: https://github.com/0day-ci/linux/commits/Dan-Murphy/DP83869-WoL-and-Speed-optimization/20200925-002844 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 3fc826f121d89c5aa4afd7b3408b07e0ff59466b config: x86_64-randconfig-m001-20200925 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 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/phy/dp83869.c:205 dp83869_set_wol() warn: impossible condition '(val_rxcfg < 0) => (0-u16max < 0)' drivers/net/phy/dp83869.c:209 dp83869_set_wol() warn: impossible condition '(val_micr < 0) => (0-u16max < 0)' drivers/net/phy/dp83869.c:301 dp83869_get_wol() warn: impossible condition '(value < 0) => (0-u16max < 0)' drivers/net/phy/dp83869.c:318 dp83869_get_wol() warn: impossible condition '(sopass_val < 0) => (0-u16max < 0)' Old smatch warnings: drivers/net/phy/dp83869.c:328 dp83869_get_wol() warn: impossible condition '(sopass_val < 0) => (0-u16max < 0)' drivers/net/phy/dp83869.c:338 dp83869_get_wol() warn: impossible condition '(sopass_val < 0) => (0-u16max < 0)' vim +205 drivers/net/phy/dp83869.c cfd39675171ca5b Dan Murphy 2020-09-24 196 static int dp83869_set_wol(struct phy_device *phydev, cfd39675171ca5b Dan Murphy 2020-09-24 197 struct ethtool_wolinfo *wol) cfd39675171ca5b Dan Murphy 2020-09-24 198 { cfd39675171ca5b Dan Murphy 2020-09-24 199 struct net_device *ndev = phydev->attached_dev; cfd39675171ca5b Dan Murphy 2020-09-24 200 u16 val_rxcfg, val_micr; cfd39675171ca5b Dan Murphy 2020-09-24 201 u8 *mac; cfd39675171ca5b Dan Murphy 2020-09-24 202 int ret; cfd39675171ca5b Dan Murphy 2020-09-24 203 cfd39675171ca5b Dan Murphy 2020-09-24 204 val_rxcfg = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_RXFCFG); cfd39675171ca5b Dan Murphy 2020-09-24 @205 if (val_rxcfg < 0) ^ This needs to be int instead of u16. cfd39675171ca5b Dan Murphy 2020-09-24 206 return val_rxcfg; cfd39675171ca5b Dan Murphy 2020-09-24 207 cfd39675171ca5b Dan Murphy 2020-09-24 208 val_micr = phy_read(phydev, MII_DP83869_MICR); cfd39675171ca5b Dan Murphy 2020-09-24 @209 if (val_micr < 0) cfd39675171ca5b Dan Murphy 2020-09-24 210 return val_micr; cfd39675171ca5b Dan Murphy 2020-09-24 211 cfd39675171ca5b Dan Murphy 2020-09-24 212 if (wol->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_UCAST | cfd39675171ca5b Dan Murphy 2020-09-24 213 WAKE_BCAST)) { --- 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 -- kbu...@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org
Re: [f2fs-dev] KMSAN: uninit-value in f2fs_lookup
On Fri, Sep 25, 2020 at 05:06:33PM +0800, Chao Yu wrote: > Hi, > > I don't see any problem here, thanks for your report. :) > I bet the uninitialize value is because "max_depth" is zero. 352 struct f2fs_dir_entry *__f2fs_find_entry(struct inode *dir, 353 const struct f2fs_filename *fname, 354 struct page **res_page) The stack trace says this isn't initialized. 355 { 356 unsigned long npages = dir_blocks(dir); 357 struct f2fs_dir_entry *de = NULL; 358 unsigned int max_depth; 359 unsigned int level; 360 361 if (f2fs_has_inline_dentry(dir)) { 362 *res_page = NULL; 363 de = f2fs_find_in_inline_dir(dir, fname, res_page); 364 goto out; 365 } 366 367 if (npages == 0) { 368 *res_page = NULL; 369 goto out; 370 } 371 372 max_depth = F2FS_I(dir)->i_current_depth; 373 if (unlikely(max_depth > MAX_DIR_HASH_DEPTH)) { 374 f2fs_warn(F2FS_I_SB(dir), "Corrupted max_depth of %lu: %u", 375dir->i_ino, max_depth); 376 max_depth = MAX_DIR_HASH_DEPTH; 377 f2fs_i_depth_write(dir, max_depth); 378 } 379 380 for (level = 0; level < max_depth; level++) { ^ If "max_depth" is zero, then we never enter this loop. 381 *res_page = NULL; 382 de = find_in_level(dir, level, fname, res_page); 383 if (de || IS_ERR(*res_page)) 384 break; 385 } 386 out: 387 /* This is to increase the speed of f2fs_create */ 388 if (!de) 389 F2FS_I(dir)->task = current; 390 return de; Which means that we return a NULL "de" and "*res_page" is uninitialized and that matches what syzbot found throug runtime testing. 391 } regards, dan carpenter