Fix radeon kms compiled with clang.
Michel Dänzer
michel at daenzer.net
Sun Dec 1 19:02:35 PST 2013
On Sam, 2013-11-30 at 17:38 +0100, Christiano F. Haesbaert wrote:
> This will prevent xorg from segfaulting at startup if compiled with
> clang, this was observed in bitrig (openbsd fork), as well as other
> systems, as it can be seen here:
>
> https://bugs.freedesktop.org/show_bug.cgi?id=47160
>
> This patch makes my radeon hd6770 work without problems in clang.
>
> ps: I'm not subscribed to the list
>
> From c0795485027baba0b8cff90f6d30fa008265469b Mon Sep 17 00:00:00 2001
> From: "Christiano F. Haesbaert" <haesbaert at haesbaert.org>
> Date: Sat, 30 Nov 2013 17:33:07 +0100
> Subject: [PATCH] Fix radeon kms on clang.
>
> clang optimizations will consider this undefined behaviour due to
> uninitiliazed data. Xorg was segfaulting on startup with radeonkms on
> a HD6770, found out by fixing the clang warnings.
> ---
> src/radeon_dri2.c | 2 +-
> src/radeon_kms.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git src/radeon_dri2.c src/radeon_dri2.c
> index 79d8f39..4498606 100644
> --- src/radeon_dri2.c
> +++ src/radeon_dri2.c
> @@ -576,7 +576,7 @@ static void
> radeon_dri2_client_state_changed(CallbackListPtr *ClientStateCallback, pointer data, pointer calldata)
> {
> DRI2ClientEventsPtr pClientEventsPriv;
> - DRI2FrameEventPtr ref;
> + DRI2FrameEventPtr ref = NULL;
> NewClientInfoRec *clientinfo = calldata;
> ClientPtr pClient = clientinfo->client;
> pClientEventsPriv = GetDRI2ClientEvents(pClient);
> diff --git src/radeon_kms.c src/radeon_kms.c
> index 44a0139..223d669 100644
> --- src/radeon_kms.c
> +++ src/radeon_kms.c
> @@ -270,7 +270,7 @@ static void
> radeon_dirty_update(ScreenPtr screen)
> {
> RegionPtr region;
> - PixmapDirtyUpdatePtr ent;
> + PixmapDirtyUpdatePtr ent = NULL;
>
> if (xorg_list_is_empty(&screen->pixmap_dirty_list))
> return;
I think it would be better to address this in xorg_list_for_each_entry()
or in clang instead of working around it in users of
xorg_list_for_each_entry(). Have there been any efforts along those
lines?
Anyway, please make sure patches you submit have a Signed-off-by: tag.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the xorg-driver-ati
mailing list