From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751492AbdFGEyz (ORCPT ); Wed, 7 Jun 2017 00:54:55 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2089 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975AbdFGEyy (ORCPT ); Wed, 7 Jun 2017 00:54:54 -0400 X-Greylist: delayed 426 seconds by postgrey-1.27 at vger.kernel.org; Wed, 07 Jun 2017 00:54:52 EDT From: Guan Junxiong Subject: Re: [PATCH v5 9/9] nvmet: allow overriding the NVMe VS via configfs To: Johannes Thumshirn , Christoph Hellwig , Sagi Grimberg , Keith Busch CC: , Hannes Reinecke , "Linux NVMe Mailinglist" , Linux Kernel Mailinglist , , "Hege (A)" , Yang Feng References: <20170606143617.32143-1-jthumshirn@suse.de> <20170606143617.32143-10-jthumshirn@suse.de> Message-ID: <1e6c06b6-4aec-d2bf-5361-7b656b64dc22@huawei.com> Date: Wed, 7 Jun 2017 12:47:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170606143617.32143-10-jthumshirn@suse.de> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.169.94.217] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.5937855F.0025,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ed47cb8e0c6f19cfc9c0e2008ba93959 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi,Johannes On 2017/6/6 22:36, Johannes Thumshirn wrote: > Allow overriding the announced NVMe Version of a via configfs. > +static ssize_t nvmet_subsys_version_store(struct config_item *item, > + const char *page, size_t count) > +{ > + struct nvmet_subsys *subsys = to_subsys(item); > + int major, minor, tertiary; > + int ret; > + > + > + ret = sscanf(page, "%d.%d.%d\n", &major, &minor, &tertiary); > + if (ret != 2 && ret != 3) > + return -EINVAL; > + > + down_write(&nvmet_config_sem); > + subsys->ver = NVME_VS(major, minor, tertiary); tertiary variable is not initialized, which could induce garbage info if ret = 2 > +++ b/include/linux/nvme.h > @@ -1070,4 +1070,8 @@ struct nvme_completion { > #define NVME_VS(major, minor, tertiary) \ > (((major) << 16) | ((minor) << 8) | (tertiary)) > > +#define NVME_MAJOR(ver) ((ver) >> 16) > +#define NVME_MINOR(ver) (((ver) >> 8) & 0xff) > +#define NVME_TERTIARY(ver) ((ver) & 0xff)the above line could be aligned with the preceding two lines Except for those above, others looks good for me. Reviewed-by: Guan Junxiong