* [PATCH] nvmet: fix mismatched serial
@ 2020-12-11 6:54 ` zhenwei pi
0 siblings, 0 replies; 5+ messages in thread
From: zhenwei pi @ 2020-12-11 6:54 UTC (permalink / raw)
To: hch, sagi, chaitanya.kulkarni; +Cc: linux-nvme, linux-kernel, pizhenwei
Target side uses 'bin2hex' to convert u64 serial number to a hex
string, saving serial number as be64 to keep right byte order.
Test on x86 server, config '0123456789abcdef' to 'attr_serial' on
target side, and run 'nvme id-ctrl /dev/nvme0' on initiator side,
then we can get the same SN string.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
drivers/nvme/target/configfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index 37e1d7784e17..e7808a86ccef 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -997,7 +997,7 @@ static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
{
struct nvmet_subsys *subsys = to_subsys(item);
- return snprintf(page, PAGE_SIZE, "%llx\n", subsys->serial);
+ return snprintf(page, PAGE_SIZE, "%llx\n", be64_to_cpu(subsys->serial));
}
static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
@@ -1009,7 +1009,7 @@ static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
return -EINVAL;
down_write(&nvmet_config_sem);
- to_subsys(item)->serial = serial;
+ to_subsys(item)->serial = cpu_to_be64(serial);
up_write(&nvmet_config_sem);
return count;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] nvmet: fix mismatched serial
@ 2020-12-11 6:54 ` zhenwei pi
0 siblings, 0 replies; 5+ messages in thread
From: zhenwei pi @ 2020-12-11 6:54 UTC (permalink / raw)
To: hch, sagi, chaitanya.kulkarni; +Cc: pizhenwei, linux-kernel, linux-nvme
Target side uses 'bin2hex' to convert u64 serial number to a hex
string, saving serial number as be64 to keep right byte order.
Test on x86 server, config '0123456789abcdef' to 'attr_serial' on
target side, and run 'nvme id-ctrl /dev/nvme0' on initiator side,
then we can get the same SN string.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
---
drivers/nvme/target/configfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index 37e1d7784e17..e7808a86ccef 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -997,7 +997,7 @@ static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
{
struct nvmet_subsys *subsys = to_subsys(item);
- return snprintf(page, PAGE_SIZE, "%llx\n", subsys->serial);
+ return snprintf(page, PAGE_SIZE, "%llx\n", be64_to_cpu(subsys->serial));
}
static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
@@ -1009,7 +1009,7 @@ static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
return -EINVAL;
down_write(&nvmet_config_sem);
- to_subsys(item)->serial = serial;
+ to_subsys(item)->serial = cpu_to_be64(serial);
up_write(&nvmet_config_sem);
return count;
--
2.25.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] nvmet: fix mismatched serial
2020-12-11 6:54 ` zhenwei pi
(?)
@ 2020-12-11 17:39 ` kernel test robot
-1 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-12-11 17:39 UTC (permalink / raw)
To: zhenwei pi, hch, sagi, chaitanya.kulkarni
Cc: kbuild-all, linux-nvme, linux-kernel, pizhenwei
[-- Attachment #1: Type: text/plain, Size: 2957 bytes --]
Hi zhenwei,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc7 next-20201211]
[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/zhenwei-pi/nvmet-fix-mismatched-serial/20201211-150008
base: git://git.infradead.org/users/hch/configfs.git for-next
config: openrisc-randconfig-s031-20201209 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-179-ga00755aa-dirty
# https://github.com/0day-ci/linux/commit/57f71eb4dff3b1b3ecef2f0368f710025c5d47f2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review zhenwei-pi/nvmet-fix-mismatched-serial/20201211-150008
git checkout 57f71eb4dff3b1b3ecef2f0368f710025c5d47f2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
>> drivers/nvme/target/configfs.c:1000:52: sparse: sparse: cast to restricted __be64
>> drivers/nvme/target/configfs.c:1012:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] serial @@ got restricted __be64 [usertype] @@
drivers/nvme/target/configfs.c:1012:33: sparse: expected unsigned long long [usertype] serial
drivers/nvme/target/configfs.c:1012:33: sparse: got restricted __be64 [usertype]
vim +1000 drivers/nvme/target/configfs.c
994
995 static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
996 char *page)
997 {
998 struct nvmet_subsys *subsys = to_subsys(item);
999
> 1000 return snprintf(page, PAGE_SIZE, "%llx\n", be64_to_cpu(subsys->serial));
1001 }
1002
1003 static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
1004 const char *page, size_t count)
1005 {
1006 u64 serial;
1007
1008 if (sscanf(page, "%llx\n", &serial) != 1)
1009 return -EINVAL;
1010
1011 down_write(&nvmet_config_sem);
> 1012 to_subsys(item)->serial = cpu_to_be64(serial);
1013 up_write(&nvmet_config_sem);
1014
1015 return count;
1016 }
1017 CONFIGFS_ATTR(nvmet_subsys_, attr_serial);
1018
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21934 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nvmet: fix mismatched serial
@ 2020-12-11 17:39 ` kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-12-11 17:39 UTC (permalink / raw)
To: zhenwei pi, hch, sagi, chaitanya.kulkarni
Cc: pizhenwei, kbuild-all, linux-kernel, linux-nvme
[-- Attachment #1: Type: text/plain, Size: 2957 bytes --]
Hi zhenwei,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc7 next-20201211]
[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/zhenwei-pi/nvmet-fix-mismatched-serial/20201211-150008
base: git://git.infradead.org/users/hch/configfs.git for-next
config: openrisc-randconfig-s031-20201209 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-179-ga00755aa-dirty
# https://github.com/0day-ci/linux/commit/57f71eb4dff3b1b3ecef2f0368f710025c5d47f2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review zhenwei-pi/nvmet-fix-mismatched-serial/20201211-150008
git checkout 57f71eb4dff3b1b3ecef2f0368f710025c5d47f2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
>> drivers/nvme/target/configfs.c:1000:52: sparse: sparse: cast to restricted __be64
>> drivers/nvme/target/configfs.c:1012:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] serial @@ got restricted __be64 [usertype] @@
drivers/nvme/target/configfs.c:1012:33: sparse: expected unsigned long long [usertype] serial
drivers/nvme/target/configfs.c:1012:33: sparse: got restricted __be64 [usertype]
vim +1000 drivers/nvme/target/configfs.c
994
995 static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
996 char *page)
997 {
998 struct nvmet_subsys *subsys = to_subsys(item);
999
> 1000 return snprintf(page, PAGE_SIZE, "%llx\n", be64_to_cpu(subsys->serial));
1001 }
1002
1003 static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
1004 const char *page, size_t count)
1005 {
1006 u64 serial;
1007
1008 if (sscanf(page, "%llx\n", &serial) != 1)
1009 return -EINVAL;
1010
1011 down_write(&nvmet_config_sem);
> 1012 to_subsys(item)->serial = cpu_to_be64(serial);
1013 up_write(&nvmet_config_sem);
1014
1015 return count;
1016 }
1017 CONFIGFS_ATTR(nvmet_subsys_, attr_serial);
1018
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21934 bytes --]
[-- Attachment #3: Type: text/plain, Size: 158 bytes --]
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] nvmet: fix mismatched serial
@ 2020-12-11 17:39 ` kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-12-11 17:39 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3026 bytes --]
Hi zhenwei,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on linux/master linus/master v5.10-rc7 next-20201211]
[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/zhenwei-pi/nvmet-fix-mismatched-serial/20201211-150008
base: git://git.infradead.org/users/hch/configfs.git for-next
config: openrisc-randconfig-s031-20201209 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-179-ga00755aa-dirty
# https://github.com/0day-ci/linux/commit/57f71eb4dff3b1b3ecef2f0368f710025c5d47f2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review zhenwei-pi/nvmet-fix-mismatched-serial/20201211-150008
git checkout 57f71eb4dff3b1b3ecef2f0368f710025c5d47f2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
>> drivers/nvme/target/configfs.c:1000:52: sparse: sparse: cast to restricted __be64
>> drivers/nvme/target/configfs.c:1012:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] serial @@ got restricted __be64 [usertype] @@
drivers/nvme/target/configfs.c:1012:33: sparse: expected unsigned long long [usertype] serial
drivers/nvme/target/configfs.c:1012:33: sparse: got restricted __be64 [usertype]
vim +1000 drivers/nvme/target/configfs.c
994
995 static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
996 char *page)
997 {
998 struct nvmet_subsys *subsys = to_subsys(item);
999
> 1000 return snprintf(page, PAGE_SIZE, "%llx\n", be64_to_cpu(subsys->serial));
1001 }
1002
1003 static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
1004 const char *page, size_t count)
1005 {
1006 u64 serial;
1007
1008 if (sscanf(page, "%llx\n", &serial) != 1)
1009 return -EINVAL;
1010
1011 down_write(&nvmet_config_sem);
> 1012 to_subsys(item)->serial = cpu_to_be64(serial);
1013 up_write(&nvmet_config_sem);
1014
1015 return count;
1016 }
1017 CONFIGFS_ATTR(nvmet_subsys_, attr_serial);
1018
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 21934 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-11 19:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 6:54 [PATCH] nvmet: fix mismatched serial zhenwei pi
2020-12-11 6:54 ` zhenwei pi
2020-12-11 17:39 ` kernel test robot
2020-12-11 17:39 ` kernel test robot
2020-12-11 17:39 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.