GNOME Bugzilla – Bug 730559
dmabuf: fix checking mmap flags
Last modified: 2014-06-04 14:03:39 UTC
Created attachment 276970 [details] [review] patch A simple '&' is not sufficiant. With mmapping_flags == PROT_READ and prot == PROT_READ|PROT_WRITE the check produces the wrong result. Change the check to make sure that prot is a subset of mmapping_flags.
It's conceptually correct of course, thanks for the patch. Though, now that I look at that closely I wonder if we didn't got something wrong. Normally the rules to allow mapping or not a memory are handled in GstMemory code and we should never end-up rejecting a map accepted by GStreamer. I would need to review does rules as I realize I don't know them, but is there a risk that GStreamer rules would allow mapping a buffers, but because of the previous mapping we have done, only read, or only write, we would fail doing so ?
Comment on attachment 276970 [details] [review] patch commit 42623c995e97a4eda3ca641b37584a4f66f9e095 Author: Michael Olbrich <m.olbrich@pengutronix.de> Date: Tue May 20 12:28:15 2014 +0200 dmabuf: fix checking mmap flags A simple '&' is not sufficiant. With mmapping_flags == PROT_READ and prot == PROT_READ|PROT_WRITE the check produces the wrong result. Change the check to make sure that prot is a subset of mmapping_flags. https://bugzilla.gnome.org/show_bug.cgi?id=730559
Thanks for this patch. As said, it's clearly correct way of checking it's a subset of prot, otherwise it conly check that at least one of the flags is there, and may fail if none are there.