On Tue, Nov 10, 2015 at 11:24:47AM -0500, Jeff Moyer wrote:
> Jerry Hoemann <[email protected]> writes:
> 
> > @@ -633,10 +718,11 @@ static int match_dimm(struct device *dev, void *data)
> >  
> >  static long nvdimm_ioctl(struct file *file, unsigned int cmd, unsigned 
> > long arg)
> >  {
> > -   int rc = -ENXIO, read_only;
> > +   int rc = -ENXIO, ro;
> >     struct nvdimm_bus *nvdimm_bus;
> > +   unsigned int type = _IOC_TYPE(cmd);
> >  
> > -   read_only = (O_RDWR != (file->f_flags & O_ACCMODE));
> > +   ro = (O_RDWR != (file->f_flags & O_ACCMODE));
> 
> I'm still reviewing the rest of this, but this is bugging me.  The
> existing check for read_only looks pretty fishy to me.  O_WRONLY is a
> thing (even though it's probably not a supportable mode for this ioctl).
> Why not just check for O_RDONLY?


Good question.  I'll look into changing for version 2.
I suspect you would like something more like:

        ro = ((file->f_flags & O_ACCMODE) == O_RDONLY);

> 
> Cheers,
> Jeff

-- 

-----------------------------------------------------------------------------
Jerry Hoemann            Software Engineer      Hewlett-Packard Enterprise

3404 E Harmony Rd. MS 36                        phone:  (970) 898-1022
Ft. Collins, CO 80528                           FAX:    (970) 898-0707
                                                email:  [email protected]
-----------------------------------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to