linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib/test_kmod: remove a NULL test
@ 2020-02-28  9:24 Dan Carpenter
  2020-02-28 13:04 ` Luis Chamberlain
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-02-28  9:24 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: linux-kernel, kernel-janitors

The "info" pointer has already been dereferenced so checking here is
too late.  Fortunately, we never pass NULL pointers to the
test_kmod_put_module() function so the test can simply be removed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 lib/test_kmod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 9cf77628fc91..e651c37d56db 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -204,7 +204,7 @@ static void test_kmod_put_module(struct kmod_test_device_info *info)
 	case TEST_KMOD_DRIVER:
 		break;
 	case TEST_KMOD_FS_TYPE:
-		if (info && info->fs_sync && info->fs_sync->owner)
+		if (info->fs_sync && info->fs_sync->owner)
 			module_put(info->fs_sync->owner);
 		break;
 	default:
-- 
2.11.0


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

* Re: [PATCH] lib/test_kmod: remove a NULL test
  2020-02-28  9:24 [PATCH] lib/test_kmod: remove a NULL test Dan Carpenter
@ 2020-02-28 13:04 ` Luis Chamberlain
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Chamberlain @ 2020-02-28 13:04 UTC (permalink / raw)
  To: Dan Carpenter, Andrew Morton; +Cc: linux-kernel, kernel-janitors

On Fri, Feb 28, 2020 at 12:24:52PM +0300, Dan Carpenter wrote:
> The "info" pointer has already been dereferenced so checking here is
> too late.  Fortunately, we never pass NULL pointers to the
> test_kmod_put_module() function so the test can simply be removed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Luis Chamberlain <mcgrof@kernel.org>

Andrew, mind this going up through you? I'll bounce you the original
next.

  Luis

> ---
>  lib/test_kmod.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/test_kmod.c b/lib/test_kmod.c
> index 9cf77628fc91..e651c37d56db 100644
> --- a/lib/test_kmod.c
> +++ b/lib/test_kmod.c
> @@ -204,7 +204,7 @@ static void test_kmod_put_module(struct kmod_test_device_info *info)
>  	case TEST_KMOD_DRIVER:
>  		break;
>  	case TEST_KMOD_FS_TYPE:
> -		if (info && info->fs_sync && info->fs_sync->owner)
> +		if (info->fs_sync && info->fs_sync->owner)
>  			module_put(info->fs_sync->owner);
>  		break;
>  	default:
> -- 
> 2.11.0
> 

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

end of thread, other threads:[~2020-02-28 13:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28  9:24 [PATCH] lib/test_kmod: remove a NULL test Dan Carpenter
2020-02-28 13:04 ` Luis Chamberlain

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).