Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1405216
| From | Eric Engestrom <eric.engestrom@imgtec.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] drm/mm: avoid possible null pointer dereference |
| Date | 2016-05-23 12:30 +0200 |
| Message-ID | <rBVhv-4Bg-11@gated-at.bofh.it> (permalink) |
| References | <rAg6K-6L0-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, May 18, 2016 at 10:17:19PM +0200, Heinrich Schuchardt wrote:
> Do not dereference node before the check if node is NULL.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> drivers/gpu/drm/drm_mm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index 04de6fd..cb39f45 100644
> --- a/drivers/gpu/drm/drm_mm.c
> +++ b/drivers/gpu/drm/drm_mm.c
> @@ -179,12 +179,14 @@ static void drm_mm_insert_helper(struct drm_mm_node *hole_node,
> int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node)
> {
> struct drm_mm_node *hole;
> - u64 end = node->start + node->size;
> + u64 end;
> u64 hole_start;
> u64 hole_end;
>
> BUG_ON(node == NULL);
>
> + end = node->start + node->size;
> +
> /* Find the relevant hole to add our node to */
> drm_mm_for_each_hole(hole, mm, hole_start, hole_end) {
> if (hole_start > node->start || hole_end < end)
> --
> 2.1.4
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] drm/mm: avoid possible null pointer dereference Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-05-18 22:20 +0200
Re: [PATCH] drm/mm: avoid possible null pointer dereference Eric Engestrom <eric.engestrom@imgtec.com> - 2016-05-23 12:30 +0200
Re: [PATCH] drm/mm: avoid possible null pointer dereference Daniel Vetter <daniel@ffwll.ch> - 2016-05-23 15:00 +0200
Re: [PATCH] drm/mm: avoid possible null pointer dereference Chris Wilson <chris@chris-wilson.co.uk> - 2016-05-23 15:10 +0200
Re: [PATCH] drm/mm: avoid possible null pointer dereference Eric Engestrom <eric.engestrom@imgtec.com> - 2016-05-23 15:40 +0200
Re: [PATCH] drm/mm: avoid possible null pointer dereference Chris Wilson <chris@chris-wilson.co.uk> - 2016-05-23 15:50 +0200
Re: [PATCH] drm/mm: avoid possible null pointer dereference Eric Engestrom <eric.engestrom@imgtec.com> - 2016-05-23 17:40 +0200
Re: [PATCH] drm/mm: avoid possible null pointer dereference Chris Wilson <chris@chris-wilson.co.uk> - 2016-05-23 18:00 +0200
csiph-web