Re: [PATCH] video: tegra: host: Fix bounds- and error-checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 17, 2010 at 02:36:47PM -0800, Erik Gilling wrote:
> On Tue, Nov 16, 2010 at 2:41 PM, Robert Morell <rmorell@xxxxxxxxxx> wrote:
> *snip*
> > @@ -106,7 +106,7 @@ static int nvhost_channelopen(struct inode *inode, struct file *filp)
> >        gather_size = sizeof(struct nvhost_op_pair) * NVHOST_MAX_GATHERS;
> >        priv->gather_mem = nvmap_alloc(ch->dev->nvmap, gather_size, 32,
> >                                       NVMAP_HANDLE_CACHEABLE);
> > -       if (IS_ERR(priv->gather_mem))
> > +       if (IS_ERR_OR_NULL(priv->gather_mem))
> 
> From my reading of nvmap_alloc, it will never return NULL.  Have you
> seen otherwise?

Not in practice, and I agree that it doesn't look like it will.
However, this seems like more of an implementation detail in the current
nvmap_alloc than a guarantee.  Looking at other calls to nvmap_alloc(),
2 of the 3 use IS_ERR_OR_NULL rather than IS_ERR.  I guess we should
pick one and make all of them consistent.  I think the maintenance
benefit outweighs the few extra branches, but if you think otherwise
I'll remove that hunk from this patch and change the rest to just IS_ERR
separately.

Thanks,
Robert

> -Erik
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux