netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer
@ 2023-03-13  6:58 Dongliang Mu
  2023-03-13  6:58 ` [PATCH 2/2] wifi: ray_cs: add sanity check on local->sram/rmem/amem Dongliang Mu
  2023-03-13  9:44 ` [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Dongliang Mu @ 2023-03-13  6:58 UTC (permalink / raw)
  To: Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Dongliang Mu, linux-wireless, netdev, linux-kernel

In ray_detach, it and its child function ray_release both call
del_timer(_sync) on the same timer.

Fix this by removing the del_timer_sync in the ray_detach, and revising
the del_timer to del_timer_sync.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/net/wireless/ray_cs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 1f57a0055bbd..785a5be72b2b 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -331,9 +331,6 @@ static void ray_detach(struct pcmcia_device *link)
 
 	ray_release(link);
 
-	local = netdev_priv(dev);
-	del_timer_sync(&local->timer);
-
 	if (link->priv) {
 		unregister_netdev(dev);
 		free_netdev(dev);
@@ -734,7 +731,7 @@ static void ray_release(struct pcmcia_device *link)
 
 	dev_dbg(&link->dev, "ray_release\n");
 
-	del_timer(&local->timer);
+	del_timer_sync(&local->timer);
 
 	iounmap(local->sram);
 	iounmap(local->rmem);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] wifi: ray_cs: add sanity check on local->sram/rmem/amem
  2023-03-13  6:58 [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer Dongliang Mu
@ 2023-03-13  6:58 ` Dongliang Mu
  2023-03-13  9:44 ` [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Dongliang Mu @ 2023-03-13  6:58 UTC (permalink / raw)
  To: Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Dongliang Mu, linux-wireless, netdev, linux-kernel

The ray_config uses ray_release as its unified error handling function.
However, it does not know if local->sram/rmem/amem succeeds or not.

Fix this by adding sanity check on local->sram/rmem/amem in the
ray_relase.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/net/wireless/ray_cs.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 785a5be72b2b..47d9c71b63b5 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -733,9 +733,12 @@ static void ray_release(struct pcmcia_device *link)
 
 	del_timer_sync(&local->timer);
 
-	iounmap(local->sram);
-	iounmap(local->rmem);
-	iounmap(local->amem);
+	if (local->sram)
+		iounmap(local->sram);
+	if (local->rmem)
+		iounmap(local->rmem);
+	if (local->amem)
+		iounmap(local->amem);
 	pcmcia_disable_device(link);
 
 	dev_dbg(&link->dev, "ray_release ending\n");
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer
  2023-03-13  6:58 [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer Dongliang Mu
  2023-03-13  6:58 ` [PATCH 2/2] wifi: ray_cs: add sanity check on local->sram/rmem/amem Dongliang Mu
@ 2023-03-13  9:44 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2023-03-13  9:44 UTC (permalink / raw)
  To: Dongliang Mu, Kalle Valo, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: oe-kbuild-all, netdev, Dongliang Mu, linux-wireless, linux-kernel

Hi Dongliang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.3-rc2 next-20230310]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dongliang-Mu/wifi-ray_cs-add-sanity-check-on-local-sram-rmem-amem/20230313-150341
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20230313065823.256731-1-dzm91%40hust.edu.cn
patch subject: [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230313/202303131721.wELY9b9M-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/8b405d9c164f51ae0d9a2b1e0b0460b09e71e5c9
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Dongliang-Mu/wifi-ray_cs-add-sanity-check-on-local-sram-rmem-amem/20230313-150341
        git checkout 8b405d9c164f51ae0d9a2b1e0b0460b09e71e5c9
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303131721.wELY9b9M-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/wireless/ray_cs.c: In function 'ray_detach':
>> drivers/net/wireless/ray_cs.c:325:20: warning: unused variable 'local' [-Wunused-variable]
     325 |         ray_dev_t *local;
         |                    ^~~~~
   In file included from include/linux/string.h:254,
                    from include/linux/bitmap.h:11,
                    from include/linux/cpumask.h:12,
                    from arch/x86/include/asm/paravirt.h:17,
                    from arch/x86/include/asm/cpuid.h:62,
                    from arch/x86/include/asm/processor.h:19,
                    from arch/x86/include/asm/timex.h:5,
                    from include/linux/timex.h:67,
                    from include/linux/time32.h:13,
                    from include/linux/time.h:60,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:13,
                    from drivers/net/wireless/ray_cs.c:20:
   In function 'strncpy',
       inlined from 'init_startup_params' at drivers/net/wireless/ray_cs.c:625:3:
   include/linux/fortify-string.h:68:33: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
      68 | #define __underlying_strncpy    __builtin_strncpy
         |                                 ^
   include/linux/fortify-string.h:151:16: note: in expansion of macro '__underlying_strncpy'
     151 |         return __underlying_strncpy(p, q, size);
         |                ^~~~~~~~~~~~~~~~~~~~


vim +/local +325 drivers/net/wireless/ray_cs.c

141fa61f10c419 John Daiker       2009-03-10  321  
fba395eee7d3f3 Dominik Brodowski 2006-03-31  322  static void ray_detach(struct pcmcia_device *link)
^1da177e4c3f41 Linus Torvalds    2005-04-16  323  {
cc3b4866bee996 Dominik Brodowski 2005-11-14  324  	struct net_device *dev;
cc3b4866bee996 Dominik Brodowski 2005-11-14 @325  	ray_dev_t *local;
^1da177e4c3f41 Linus Torvalds    2005-04-16  326  
624dd66957e53e Dominik Brodowski 2009-10-24  327  	dev_dbg(&link->dev, "ray_detach\n");
^1da177e4c3f41 Linus Torvalds    2005-04-16  328  
fd238232cd0ff4 Dominik Brodowski 2006-03-05  329  	this_device = NULL;
cc3b4866bee996 Dominik Brodowski 2005-11-14  330  	dev = link->priv;
cc3b4866bee996 Dominik Brodowski 2005-11-14  331  
^1da177e4c3f41 Linus Torvalds    2005-04-16  332  	ray_release(link);
^1da177e4c3f41 Linus Torvalds    2005-04-16  333  
^1da177e4c3f41 Linus Torvalds    2005-04-16  334  	if (link->priv) {
141fa61f10c419 John Daiker       2009-03-10  335  		unregister_netdev(dev);
^1da177e4c3f41 Linus Torvalds    2005-04-16  336  		free_netdev(dev);
^1da177e4c3f41 Linus Torvalds    2005-04-16  337  	}
624dd66957e53e Dominik Brodowski 2009-10-24  338  	dev_dbg(&link->dev, "ray_cs ray_detach ending\n");
^1da177e4c3f41 Linus Torvalds    2005-04-16  339  } /* ray_detach */
141fa61f10c419 John Daiker       2009-03-10  340  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-13  9:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-13  6:58 [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer Dongliang Mu
2023-03-13  6:58 ` [PATCH 2/2] wifi: ray_cs: add sanity check on local->sram/rmem/amem Dongliang Mu
2023-03-13  9:44 ` [PATCH 1/2] wifi: ray_cs: remove one redundant del_timer kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).