* [PATCH] nouveau: need to handle failed allocation
@ 2016-01-29 0:09 Insu Yun
2016-01-29 0:08 ` Ilia Mirkin
0 siblings, 1 reply; 6+ messages in thread
From: Insu Yun @ 2016-01-29 0:09 UTC (permalink / raw)
To: airlied, bskeggs, daniel.vetter, ville.syrjala, maarten.lankhorst,
treding, acourbot, dri-devel, linux-kernel
Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun
drm_property_create_range can be failed in memory pressure.
So, it needs to be handled.
Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
drivers/gpu/drm/nouveau/nouveau_display.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 24be27d..26b4902 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -443,6 +443,12 @@ nouveau_display_create_properties(struct drm_device *dev)
/* -100..+100 */
disp->color_vibrance_property =
drm_property_create_range(dev, 0, "color vibrance", 0, 200);
+
+ if (!disp->underscan_hborder_property ||
+ !disp->underscan_vborder_property ||
+ !disp->vibrant_hue_property ||
+ !disp->color_vibrance_property)
+ return;
}
int
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] nouveau: need to handle failed allocation
2016-01-29 0:09 [PATCH] nouveau: need to handle failed allocation Insu Yun
@ 2016-01-29 0:08 ` Ilia Mirkin
0 siblings, 0 replies; 6+ messages in thread
From: Ilia Mirkin @ 2016-01-29 0:08 UTC (permalink / raw)
To: Insu Yun
Cc: yeongjin.jang, taesoo, Daniel Vetter, insu,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Ben Skeggs, Thierry Reding, changwoo
On Thu, Jan 28, 2016 at 7:09 PM, Insu Yun <wuninsu@gmail.com> wrote:
> drm_property_create_range can be failed in memory pressure.
> So, it needs to be handled.
>
> Signed-off-by: Insu Yun <wuninsu@gmail.com>
> ---
> drivers/gpu/drm/nouveau/nouveau_display.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 24be27d..26b4902 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -443,6 +443,12 @@ nouveau_display_create_properties(struct drm_device *dev)
> /* -100..+100 */
> disp->color_vibrance_property =
> drm_property_create_range(dev, 0, "color vibrance", 0, 200);
> +
> + if (!disp->underscan_hborder_property ||
> + !disp->underscan_vborder_property ||
> + !disp->vibrant_hue_property ||
> + !disp->color_vibrance_property)
> + return;
Aren't we at the end of the function anyways?
> }
>
> int
> --
> 1.9.1
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nouveau: need to handle failed allocation
@ 2016-01-29 0:08 ` Ilia Mirkin
0 siblings, 0 replies; 6+ messages in thread
From: Ilia Mirkin @ 2016-01-29 0:08 UTC (permalink / raw)
To: Insu Yun
Cc: David Airlie, Ben Skeggs, Daniel Vetter, Ville Syrjälä,
maarten.lankhorst, Thierry Reding, Alexandre Courbot,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
taesoo, yeongjin.jang, insu, changwoo
On Thu, Jan 28, 2016 at 7:09 PM, Insu Yun <wuninsu@gmail.com> wrote:
> drm_property_create_range can be failed in memory pressure.
> So, it needs to be handled.
>
> Signed-off-by: Insu Yun <wuninsu@gmail.com>
> ---
> drivers/gpu/drm/nouveau/nouveau_display.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> index 24be27d..26b4902 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> @@ -443,6 +443,12 @@ nouveau_display_create_properties(struct drm_device *dev)
> /* -100..+100 */
> disp->color_vibrance_property =
> drm_property_create_range(dev, 0, "color vibrance", 0, 200);
> +
> + if (!disp->underscan_hborder_property ||
> + !disp->underscan_vborder_property ||
> + !disp->vibrant_hue_property ||
> + !disp->color_vibrance_property)
> + return;
Aren't we at the end of the function anyways?
> }
>
> int
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nouveau: need to handle failed allocation
2016-01-29 0:08 ` Ilia Mirkin
(?)
@ 2016-01-29 0:12 ` Insu Yun
2016-01-29 3:18 ` Ben Skeggs
-1 siblings, 1 reply; 6+ messages in thread
From: Insu Yun @ 2016-01-29 0:12 UTC (permalink / raw)
To: Ilia Mirkin
Cc: Yeongjin Jang, Taesoo Kim, Daniel Vetter, Yun, Insu,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Ben Skeggs, Thierry Reding, Changwoo Min
[-- Attachment #1.1: Type: text/plain, Size: 1521 bytes --]
On Thu, Jan 28, 2016 at 7:08 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Thu, Jan 28, 2016 at 7:09 PM, Insu Yun <wuninsu@gmail.com> wrote:
> > drm_property_create_range can be failed in memory pressure.
> > So, it needs to be handled.
> >
> > Signed-off-by: Insu Yun <wuninsu@gmail.com>
> > ---
> > drivers/gpu/drm/nouveau/nouveau_display.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c
> b/drivers/gpu/drm/nouveau/nouveau_display.c
> > index 24be27d..26b4902 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> > @@ -443,6 +443,12 @@ nouveau_display_create_properties(struct drm_device
> *dev)
> > /* -100..+100 */
> > disp->color_vibrance_property =
> > drm_property_create_range(dev, 0, "color vibrance", 0,
> 200);
> > +
> > + if (!disp->underscan_hborder_property ||
> > + !disp->underscan_vborder_property ||
> > + !disp->vibrant_hue_property ||
> > + !disp->color_vibrance_property)
> > + return;
>
> Aren't we at the end of the function anyways?
>
Sorry. it is not perfect patch
I found this by my static analyzer.
I have limited knowledge about this driver.
I don't want to mass up your driver.
What I want to do is to tell you there is a bug.
I think we need to return error to caller.
>
> > }
> >
> > int
> > --
> > 1.9.1
> >
>
--
Regards
Insu Yun
[-- Attachment #1.2: Type: text/html, Size: 2555 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nouveau: need to handle failed allocation
2016-01-29 0:12 ` Insu Yun
@ 2016-01-29 3:18 ` Ben Skeggs
0 siblings, 0 replies; 6+ messages in thread
From: Ben Skeggs @ 2016-01-29 3:18 UTC (permalink / raw)
To: Insu Yun, Ilia Mirkin
Cc: Yeongjin Jang, Taesoo Kim, Daniel Vetter, Yun, Insu,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Thierry Reding, Changwoo Min
[-- Attachment #1.1: Type: text/plain, Size: 2069 bytes --]
On 01/29/2016 10:12 AM, Insu Yun wrote:
>
> On Thu, Jan 28, 2016 at 7:08 PM, Ilia Mirkin <imirkin@alum.mit.edu
> <mailto:imirkin@alum.mit.edu>> wrote:
>
> On Thu, Jan 28, 2016 at 7:09 PM, Insu Yun <wuninsu@gmail.com
> <mailto:wuninsu@gmail.com>> wrote:
> > drm_property_create_range can be failed in memory pressure.
> > So, it needs to be handled.
> >
> > Signed-off-by: Insu Yun <wuninsu@gmail.com <mailto:wuninsu@gmail.com>>
> > ---
> > drivers/gpu/drm/nouveau/nouveau_display.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> > index 24be27d..26b4902 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> > @@ -443,6 +443,12 @@ nouveau_display_create_properties(struct drm_device *dev)
> > /* -100..+100 */
> > disp->color_vibrance_property =
> > drm_property_create_range(dev, 0, "color vibrance", 0, 200);
> > +
> > + if (!disp->underscan_hborder_property ||
> > + !disp->underscan_vborder_property ||
> > + !disp->vibrant_hue_property ||
> > + !disp->color_vibrance_property)
> > + return;
>
> Aren't we at the end of the function anyways?
>
>
> Sorry. it is not perfect patch
> I found this by my static analyzer.
> I have limited knowledge about this driver.
> I don't want to mass up your driver.
> What I want to do is to tell you there is a bug.
> I think we need to return error to caller.
I'm not so sure we do. We check for valid pointers for these when
they're actually used, so no OOPS will occur. Worst case, the driver
still loads correctly with some missing properties.
Ben.
>
>
>
> > }
> >
> > int
> > --
> > 1.9.1
> >
>
>
>
>
> --
> Regards
> Insu Yun
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nouveau: need to handle failed allocation
@ 2016-01-29 3:18 ` Ben Skeggs
0 siblings, 0 replies; 6+ messages in thread
From: Ben Skeggs @ 2016-01-29 3:18 UTC (permalink / raw)
To: Insu Yun, Ilia Mirkin
Cc: David Airlie, Daniel Vetter, Ville Syrjälä,
maarten.lankhorst, Thierry Reding, Alexandre Courbot,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Taesoo Kim, Yeongjin Jang, Yun, Insu, Changwoo Min
[-- Attachment #1: Type: text/plain, Size: 2069 bytes --]
On 01/29/2016 10:12 AM, Insu Yun wrote:
>
> On Thu, Jan 28, 2016 at 7:08 PM, Ilia Mirkin <imirkin@alum.mit.edu
> <mailto:imirkin@alum.mit.edu>> wrote:
>
> On Thu, Jan 28, 2016 at 7:09 PM, Insu Yun <wuninsu@gmail.com
> <mailto:wuninsu@gmail.com>> wrote:
> > drm_property_create_range can be failed in memory pressure.
> > So, it needs to be handled.
> >
> > Signed-off-by: Insu Yun <wuninsu@gmail.com <mailto:wuninsu@gmail.com>>
> > ---
> > drivers/gpu/drm/nouveau/nouveau_display.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
> > index 24be27d..26b4902 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_display.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_display.c
> > @@ -443,6 +443,12 @@ nouveau_display_create_properties(struct drm_device *dev)
> > /* -100..+100 */
> > disp->color_vibrance_property =
> > drm_property_create_range(dev, 0, "color vibrance", 0, 200);
> > +
> > + if (!disp->underscan_hborder_property ||
> > + !disp->underscan_vborder_property ||
> > + !disp->vibrant_hue_property ||
> > + !disp->color_vibrance_property)
> > + return;
>
> Aren't we at the end of the function anyways?
>
>
> Sorry. it is not perfect patch
> I found this by my static analyzer.
> I have limited knowledge about this driver.
> I don't want to mass up your driver.
> What I want to do is to tell you there is a bug.
> I think we need to return error to caller.
I'm not so sure we do. We check for valid pointers for these when
they're actually used, so no OOPS will occur. Worst case, the driver
still loads correctly with some missing properties.
Ben.
>
>
>
> > }
> >
> > int
> > --
> > 1.9.1
> >
>
>
>
>
> --
> Regards
> Insu Yun
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-29 3:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29 0:09 [PATCH] nouveau: need to handle failed allocation Insu Yun
2016-01-29 0:08 ` Ilia Mirkin
2016-01-29 0:08 ` Ilia Mirkin
2016-01-29 0:12 ` Insu Yun
2016-01-29 3:18 ` Ben Skeggs
2016-01-29 3:18 ` Ben Skeggs
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.