linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: initialize variable before logical OR'ing it
@ 2016-06-02 15:51 Jay Freyensee
  2016-06-14 23:34 ` J Freyensee
  2016-07-19 19:31 ` J Freyensee
  0 siblings, 2 replies; 5+ messages in thread
From: Jay Freyensee @ 2016-06-02 15:51 UTC (permalink / raw)


It is typically not good coding or secure coding practice
to logical OR a variable without an initialization value first.
Here on this line:

integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;

BLK_INTEGRITY_DEVICE_CAPABLE is being OR'ed to a member variable
never set to an initial value. This patch fixes that.

Signed-off-by: Jay Freyensee <james.p.freyensee at intel.com>
Reviewed-by: Ming Lin <ming.l at samsung.com>
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
Reviewed-by: Christoph Hellwig <hch at lst.de>

---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f6f6fdf..33fe610 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -843,6 +843,7 @@ static void nvme_init_integrity(struct nvme_ns *ns)
 {
 	struct blk_integrity integrity;
 
+	memset(&integrity, 0, sizeof(integrity));
 	switch (ns->pi_type) {
 	case NVME_NS_DPS_PI_TYPE3:
 		integrity.profile = &t10_pi_type3_crc;
-- 
2.4.3

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

* [PATCH] nvme: initialize variable before logical OR'ing it
  2016-06-02 15:51 [PATCH] nvme: initialize variable before logical OR'ing it Jay Freyensee
@ 2016-06-14 23:34 ` J Freyensee
  2016-07-19 19:31 ` J Freyensee
  1 sibling, 0 replies; 5+ messages in thread
From: J Freyensee @ 2016-06-14 23:34 UTC (permalink / raw)


On Thu, 2016-06-02@08:51 -0700, Jay Freyensee wrote:

Ping?

> It is typically not good coding or secure coding practice
> to logical OR a variable without an initialization value first.
> Here on this line:
> 
> integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
> 
> BLK_INTEGRITY_DEVICE_CAPABLE is being OR'ed to a member variable
> never set to an initial value. This patch fixes that.
> 
> Signed-off-by: Jay Freyensee <james.p.freyensee at intel.com>
> Reviewed-by: Ming Lin <ming.l at samsung.com>
> Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> 
> ---
>  drivers/nvme/host/core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index f6f6fdf..33fe610 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -843,6 +843,7 @@ static void nvme_init_integrity(struct nvme_ns
> *ns)
>  {
>  	struct blk_integrity integrity;
>  
> +	memset(&integrity, 0, sizeof(integrity));
>  	switch (ns->pi_type) {
>  	case NVME_NS_DPS_PI_TYPE3:
>  		integrity.profile = &t10_pi_type3_crc;

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

* [PATCH] nvme: initialize variable before logical OR'ing it
  2016-06-02 15:51 [PATCH] nvme: initialize variable before logical OR'ing it Jay Freyensee
  2016-06-14 23:34 ` J Freyensee
@ 2016-07-19 19:31 ` J Freyensee
  2016-07-21  3:27   ` Jens Axboe
  1 sibling, 1 reply; 5+ messages in thread
From: J Freyensee @ 2016-07-19 19:31 UTC (permalink / raw)


On Thu, 2016-06-02@08:51 -0700, Jay Freyensee wrote:

Jens,

I believe this patch fix got missed?  Or is there a problem with this
patch?

Thanks,
Jay

> It is typically not good coding or secure coding practice
> to logical OR a variable without an initialization value first.
> Here on this line:
> 
> integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
> 
> BLK_INTEGRITY_DEVICE_CAPABLE is being OR'ed to a member variable
> never set to an initial value. This patch fixes that.
> 
> Signed-off-by: Jay Freyensee <james.p.freyensee at intel.com>
> Reviewed-by: Ming Lin <ming.l at samsung.com>
> Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> 
> ---
>  drivers/nvme/host/core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index f6f6fdf..33fe610 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -843,6 +843,7 @@ static void nvme_init_integrity(struct nvme_ns
> *ns)
>  {
>  	struct blk_integrity integrity;
>  
> +	memset(&integrity, 0, sizeof(integrity));
>  	switch (ns->pi_type) {
>  	case NVME_NS_DPS_PI_TYPE3:
>  		integrity.profile = &t10_pi_type3_crc;

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

* [PATCH] nvme: initialize variable before logical OR'ing it
  2016-07-19 19:31 ` J Freyensee
@ 2016-07-21  3:27   ` Jens Axboe
  2016-07-21 16:36     ` J Freyensee
  0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2016-07-21  3:27 UTC (permalink / raw)




On 07/19/2016 01:31 PM, J Freyensee wrote:
> On Thu, 2016-06-02@08:51 -0700, Jay Freyensee wrote:
>
> Jens,
>
> I believe this patch fix got missed?  Or is there a problem with this
> patch?

No problem, just got missed. Added, thanks.

-- 
Jens Axboe

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

* [PATCH] nvme: initialize variable before logical OR'ing it
  2016-07-21  3:27   ` Jens Axboe
@ 2016-07-21 16:36     ` J Freyensee
  0 siblings, 0 replies; 5+ messages in thread
From: J Freyensee @ 2016-07-21 16:36 UTC (permalink / raw)


On Wed, 2016-07-20@21:27 -0600, Jens Axboe wrote:
> 
> On 07/19/2016 01:31 PM, J Freyensee wrote:
> > On Thu, 2016-06-02@08:51 -0700, Jay Freyensee wrote:
> > 
> > Jens,
> > 
> > I believe this patch fix got missed?  Or is there a problem with
> > this
> > patch?
> 
> No problem, just got missed. Added, thanks.

Thanks Jens!

> 

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

end of thread, other threads:[~2016-07-21 16:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-02 15:51 [PATCH] nvme: initialize variable before logical OR'ing it Jay Freyensee
2016-06-14 23:34 ` J Freyensee
2016-07-19 19:31 ` J Freyensee
2016-07-21  3:27   ` Jens Axboe
2016-07-21 16:36     ` J Freyensee

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