linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] bcache: correct return value in register_nvdimm_meta()
@ 2021-02-10 13:56 Coly Li
  2021-02-10 13:56 ` [PATCH 2/4] bcache: use div_u64() in init_owner_info() Coly Li
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Coly Li @ 2021-02-10 13:56 UTC (permalink / raw)
  To: linux-bcache; +Cc: linux-block, Coly Li, kernel test robot

'ret' should be used a return value, thi patch fixes this error.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Coly Li <colyli@suse.de>
---
 drivers/md/bcache/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index c273eeef0d38..47a1225b3496 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2554,7 +2554,7 @@ static ssize_t register_nvdimm_meta(struct kobject *k, struct kobj_attribute *at
 		ret = -EINVAL;
 	}
 
-	return size;
+	return ret;
 }
 #endif
 
-- 
2.26.2


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

* [PATCH 2/4] bcache: use div_u64() in init_owner_info()
  2021-02-10 13:56 [PATCH 1/4] bcache: correct return value in register_nvdimm_meta() Coly Li
@ 2021-02-10 13:56 ` Coly Li
  2021-02-10 19:50   ` Chaitanya Kulkarni
  2021-02-10 13:56 ` [PATCH 3/4] bcache: unify code comments style in nvm-pages.c Coly Li
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Coly Li @ 2021-02-10 13:56 UTC (permalink / raw)
  To: linux-bcache
  Cc: linux-block, Coly Li, kernel test robot, Jianpeng Ma, Qiaowei Ren

Kernel test robot reports the build-in u64/u32 in init_owner_info()
doesn't work for m68k arch, the explict div_u64() should be used.

This patch explicit uses div_u64() to do the u64/u32 division on
32bit m68k arch.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Coly Li <colyli@suse.de>
Cc: Jianpeng Ma <jianpeng.ma@intel.com>
Cc: Qiaowei Ren <qiaowei.ren@intel.com>
---
 drivers/md/bcache/nvm-pages.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/nvm-pages.c b/drivers/md/bcache/nvm-pages.c
index c350dcd696dd..8be761467d8f 100644
--- a/drivers/md/bcache/nvm-pages.c
+++ b/drivers/md/bcache/nvm-pages.c
@@ -521,7 +521,7 @@ static int init_owner_info(struct bch_nvm_namespace *ns)
 	only_set->owner_list_size = owner_list_head->size;
 	only_set->owner_list_used = owner_list_head->used;
 
-	remove_owner_space(ns, 0, ns->pages_offset/ns->page_size);
+	remove_owner_space(ns, 0, div_u64(ns->pages_offset, ns->page_size));
 
 	for (i = 0; i < owner_list_head->used; i++) {
 		owner_head = &owner_list_head->heads[i];
-- 
2.26.2


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

* [PATCH 3/4] bcache: unify code comments style in nvm-pages.c
  2021-02-10 13:56 [PATCH 1/4] bcache: correct return value in register_nvdimm_meta() Coly Li
  2021-02-10 13:56 ` [PATCH 2/4] bcache: use div_u64() in init_owner_info() Coly Li
@ 2021-02-10 13:56 ` Coly Li
  2021-02-10 19:49   ` Chaitanya Kulkarni
  2021-02-10 13:56 ` [PATCH 4/4] bcache: fix a typo in nvme-pages.c Coly Li
  2021-02-10 19:52 ` [PATCH 1/4] bcache: correct return value in register_nvdimm_meta() Chaitanya Kulkarni
  3 siblings, 1 reply; 8+ messages in thread
From: Coly Li @ 2021-02-10 13:56 UTC (permalink / raw)
  To: linux-bcache; +Cc: linux-block, Coly Li

Make nvm-pages.c follow code comments style of other bcache code.

Signed-off-by: Coly Li <colyli@suse.de>
---
 drivers/md/bcache/nvm-pages.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/md/bcache/nvm-pages.c b/drivers/md/bcache/nvm-pages.c
index 8be761467d8f..3ea27ea3dd54 100644
--- a/drivers/md/bcache/nvm-pages.c
+++ b/drivers/md/bcache/nvm-pages.c
@@ -270,7 +270,7 @@ static void write_owner_info(void)
 	owner_list_head->size = BCH_MAX_OWNER_LIST;
 	WARN_ON(only_set->owner_list_used > owner_list_head->size);
 
-	// in-memory owner maybe not contain alloced-pages.
+	/* in-memory owner maybe not contain alloced-pages. */
 	for (i = 0; i < only_set->owner_list_used; i++) {
 		owner_head = &owner_list_head->heads[i];
 		owner_list = only_set->owner_lists[i];
@@ -569,14 +569,14 @@ static int init_owner_info(struct bch_nvm_namespace *ns)
 					extent->nr = rec->nr;
 					WARN_ON(!is_power_of_2(extent->nr));
 
-					/*init struct page: index/private */
+					/* init struct page: index/private */
 					order = ilog2(extent->nr);
 					page = nvm_vaddr_to_page(ns, extent->kaddr);
 					set_page_private(page, order);
 					page->index = rec->pgoff;
 
 					list_add_tail(&extent->list, &extents->extent_head);
-					/*remove already alloced space*/
+					/* remove already alloced space */
 					remove_owner_space(extents->ns, rec->pgoff, rec->nr);
 				}
 				extents->nr += nvm_pgalloc_recs->used;
-- 
2.26.2


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

* [PATCH 4/4] bcache: fix a typo in nvme-pages.c
  2021-02-10 13:56 [PATCH 1/4] bcache: correct return value in register_nvdimm_meta() Coly Li
  2021-02-10 13:56 ` [PATCH 2/4] bcache: use div_u64() in init_owner_info() Coly Li
  2021-02-10 13:56 ` [PATCH 3/4] bcache: unify code comments style in nvm-pages.c Coly Li
@ 2021-02-10 13:56 ` Coly Li
  2021-02-10 19:53   ` Chaitanya Kulkarni
  2021-02-10 19:52 ` [PATCH 1/4] bcache: correct return value in register_nvdimm_meta() Chaitanya Kulkarni
  3 siblings, 1 reply; 8+ messages in thread
From: Coly Li @ 2021-02-10 13:56 UTC (permalink / raw)
  To: linux-bcache
  Cc: linux-block, Coly Li, Dan Carpenter,
	Reported-by : kernel test robot, Jianpeng Ma, Qiaowei Ren

This patch fixes a typo in init_owner_info() which causes an invalid
pointer checking from a kazlloc().

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Coly Li <colyli@suse.de>
Cc: Jianpeng Ma <jianpeng.ma@intel.com>
Cc: Qiaowei Ren <qiaowei.ren@intel.com>
---
 drivers/md/bcache/nvm-pages.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/nvm-pages.c b/drivers/md/bcache/nvm-pages.c
index 3ea27ea3dd54..9cf69dc36f3a 100644
--- a/drivers/md/bcache/nvm-pages.c
+++ b/drivers/md/bcache/nvm-pages.c
@@ -561,7 +561,7 @@ static int init_owner_info(struct bch_nvm_namespace *ns)
 				for (k = 0; k < nvm_pgalloc_recs->used; k++) {
 					rec = &nvm_pgalloc_recs->recs[k];
 					extent = kzalloc(sizeof(*extent), GFP_KERNEL);
-					if (!extents) {
+					if (!extent) {
 						mutex_unlock(&only_set->lock);
 						return -ENOMEM;
 					}
-- 
2.26.2


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

* Re: [PATCH 3/4] bcache: unify code comments style in nvm-pages.c
  2021-02-10 13:56 ` [PATCH 3/4] bcache: unify code comments style in nvm-pages.c Coly Li
@ 2021-02-10 19:49   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-10 19:49 UTC (permalink / raw)
  To: Coly Li, linux-bcache; +Cc: linux-block

On 2/10/21 06:00, Coly Li wrote:
> Make nvm-pages.c follow code comments style of other bcache code.
>
> Signed-off-by: Coly Li <colyli@suse.de>
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>


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

* Re: [PATCH 2/4] bcache: use div_u64() in init_owner_info()
  2021-02-10 13:56 ` [PATCH 2/4] bcache: use div_u64() in init_owner_info() Coly Li
@ 2021-02-10 19:50   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-10 19:50 UTC (permalink / raw)
  To: Coly Li, linux-bcache
  Cc: linux-block, kernel test robot, Jianpeng Ma, Qiaowei Ren

On 2/10/21 06:00, Coly Li wrote:
> Kernel test robot reports the build-in u64/u32 in init_owner_info()
> doesn't work for m68k arch, the explict div_u64() should be used.
>
> This patch explicit uses div_u64() to do the u64/u32 division on
> 32bit m68k arch.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Coly Li <colyli@suse.de>
> Cc: Jianpeng Ma <jianpeng.ma@intel.com>
> Cc: Qiaowei Ren <qiaowei.ren@intel.com>
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>


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

* Re: [PATCH 1/4] bcache: correct return value in register_nvdimm_meta()
  2021-02-10 13:56 [PATCH 1/4] bcache: correct return value in register_nvdimm_meta() Coly Li
                   ` (2 preceding siblings ...)
  2021-02-10 13:56 ` [PATCH 4/4] bcache: fix a typo in nvme-pages.c Coly Li
@ 2021-02-10 19:52 ` Chaitanya Kulkarni
  3 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-10 19:52 UTC (permalink / raw)
  To: Coly Li, linux-bcache; +Cc: linux-block, kernel test robot

On 2/10/21 06:00, Coly Li wrote:
> 'ret' should be used a return value, thi patch fixes this error.
How about following commit log ?

The local variable should be used to return right error code from the
register_nvdimm_meta() instead of size variable.

> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Coly Li <colyli@suse.de>
> ---
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>


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

* Re: [PATCH 4/4] bcache: fix a typo in nvme-pages.c
  2021-02-10 13:56 ` [PATCH 4/4] bcache: fix a typo in nvme-pages.c Coly Li
@ 2021-02-10 19:53   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-02-10 19:53 UTC (permalink / raw)
  To: Coly Li, linux-bcache
  Cc: linux-block, Dan Carpenter, Reported-by : kernel test robot,
	Jianpeng Ma, Qiaowei Ren

On 2/10/21 06:01, Coly Li wrote:
> This patch fixes a typo in init_owner_info() which causes an invalid
> pointer checking from a kazlloc().
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reported-by: Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Coly Li <colyli@suse.de>
> Cc: Jianpeng Ma <jianpeng.ma@intel.com>
> Cc: Qiaowei Ren <qiaowei.ren@intel.com>
Looks good.

Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>


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

end of thread, other threads:[~2021-02-10 19:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 13:56 [PATCH 1/4] bcache: correct return value in register_nvdimm_meta() Coly Li
2021-02-10 13:56 ` [PATCH 2/4] bcache: use div_u64() in init_owner_info() Coly Li
2021-02-10 19:50   ` Chaitanya Kulkarni
2021-02-10 13:56 ` [PATCH 3/4] bcache: unify code comments style in nvm-pages.c Coly Li
2021-02-10 19:49   ` Chaitanya Kulkarni
2021-02-10 13:56 ` [PATCH 4/4] bcache: fix a typo in nvme-pages.c Coly Li
2021-02-10 19:53   ` Chaitanya Kulkarni
2021-02-10 19:52 ` [PATCH 1/4] bcache: correct return value in register_nvdimm_meta() Chaitanya Kulkarni

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