[ndctl,v2,1/2] ndctl/test: Cleanup test-vs-production nvdimm module detection
diff mbox series

Message ID 158327631042.2222444.6483138766986602497.stgit@dwillia2-desk3.amr.corp.intel.com
State Accepted
Commit ea083305f1c7aeffeb38b8044e089f23294cb59f
Headers show
Series
  • [ndctl,v2,1/2] ndctl/test: Cleanup test-vs-production nvdimm module detection
Related show

Commit Message

Dan Williams March 3, 2020, 10:58 p.m. UTC
Update nfit_test_init() to use strcmp() instead of strstr() to filter
which modules are probed to come from the out-of-tree unit-test set.

Reported-by: Jan Kara <jack@suse.cz>
Link: http://lore.kernel.org/r/20200303132850.GA21048@quack2.suse.cz
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/core.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jan Kara March 4, 2020, 12:44 p.m. UTC | #1
On Tue 03-03-20 14:58:30, Dan Williams wrote:
> Update nfit_test_init() to use strcmp() instead of strstr() to filter
> which modules are probed to come from the out-of-tree unit-test set.
> 
> Reported-by: Jan Kara <jack@suse.cz>
> Link: http://lore.kernel.org/r/20200303132850.GA21048@quack2.suse.cz
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  test/core.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/test/core.c b/test/core.c
> index 888f5d8c0e42..3aa746fe6786 100644
> --- a/test/core.c
> +++ b/test/core.c
> @@ -164,7 +164,7 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
>  		 * Don't check for device-dax modules on kernels older
>  		 * than 4.7.
>  		 */
> -		if (strstr(name, "dax")
> +		if (strcmp(name, "dax") == 0
>  				&& !ndctl_test_attempt(test,
>  					KERNEL_VERSION(4, 7, 0)))
>  			continue;
> @@ -172,8 +172,8 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
>  		/*
>  		 * Skip device-dax bus-model modules on pre-v5.1
>  		 */
> -		if ((strstr(name, "dax_pmem_core")
> -				|| strstr(name, "dax_pmem_compat"))
> +		if ((strcmp(name, "dax_pmem_core") == 0
> +				|| strcmp(name, "dax_pmem_compat") == 0)
>  				&& !ndctl_test_attempt(test,
>  					KERNEL_VERSION(5, 1, 0)))
>  			continue;
>

Patch
diff mbox series

diff --git a/test/core.c b/test/core.c
index 888f5d8c0e42..3aa746fe6786 100644
--- a/test/core.c
+++ b/test/core.c
@@ -164,7 +164,7 @@  int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
 		 * Don't check for device-dax modules on kernels older
 		 * than 4.7.
 		 */
-		if (strstr(name, "dax")
+		if (strcmp(name, "dax") == 0
 				&& !ndctl_test_attempt(test,
 					KERNEL_VERSION(4, 7, 0)))
 			continue;
@@ -172,8 +172,8 @@  int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
 		/*
 		 * Skip device-dax bus-model modules on pre-v5.1
 		 */
-		if ((strstr(name, "dax_pmem_core")
-				|| strstr(name, "dax_pmem_compat"))
+		if ((strcmp(name, "dax_pmem_core") == 0
+				|| strcmp(name, "dax_pmem_compat") == 0)
 				&& !ndctl_test_attempt(test,
 					KERNEL_VERSION(5, 1, 0)))
 			continue;