summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2011-12-06kdrive: drop screen crossing code.Dave Airlie1-6/+0
The only kdrive server we probably care about anymore is Xephyr, and this screen enable/disable code totally breaks it in multi-screen mode. When you are in one screen the other stops updating. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=757457 Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-06hal: free tmp_val in one missing caseDave Airlie1-0/+1
Pointed out by coverity scan. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-12-06xv: test correct number of requests. (v2)Dave Airlie1-2/+2
Pointed out by coverity. v2: fix swapped as well, as pointed out by Alan Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-12-06xaa: avoid possible freed pointer reuse in epilogueDave Airlie1-0/+1
If the pGCPriv->flags == 2, then we try to assign the freed pGCPriv->XAAOps avoid this by clearing the flags in to be destroyed pGCPriv. Reported by coverity. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-06Xi: avoid overrun of callback array.Dave Airlie1-2/+2
This code had an off-by-one and would allow writing one past the end of the callbacks array. Pointed out by coverity. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-06xext: don't free uninitialised pointer when malloc fails. (v2)Dave Airlie1-2/+1
Initialise the pAttr->values to values so if the values allocation fails it just ends up as free(NULL). Pointed out by coverity. v2: use Alan's suggestion. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-06fbdevhw: iterate over all modes that match a mode. (v3)Adam Jackson1-8/+10
So on RHEL5 anaconda sets an xorg.conf with a fixed 800x600 mode in it, we run radeonfb and fbdev since ati won't work in userspace due to domain issues in the older codebase. On certain pseries blades the built-in KVM can't accept an 800x600-43 mode, it requires the 800x600-60 mode, so we have to have the kernel radeonfb driver reject the 800x600-43 mode when it sees it. However then fbdev doesn't try any of the other 800x600 modes in the modelist, and we end up getting a default 640x480 mode we don't want. This patch changes the mode validation loop to continue on with the other modes that match to find one that works. v2: move code around to avoid extra loop, after comment from Jamey. v3: move loop setup back into loop as per Jeremy's review. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-01Save major/minor opcodes in ClientRec for RecordAReplyKeith Packard7-36/+20
The record extension needs the major and minor opcodes in the reply hook, but the request buffer may have been freed by the time the hook is invoked. Saving the request major and minor codes as the request is executed avoids fetching from the defunct request buffer. This patch also eliminates the public MinorOpcodeOfRequest function, inlining it into Dispatch. Usages of that function have been replaced with direct access to the new ClientRec field. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-12-01Merge remote-tracking branch 'jcristau/for-keith'Keith Packard1-1/+1
2011-12-01Merge remote-tracking branch 'whot/for-keith'Keith Packard7-40/+70
2011-12-01Remove another if (E != NULL) check around free(E)Matt Turner1-2/+0
I wonder if there are any other patterns we haven't seen yet? Reviewed-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-11-29test: remove unneeded printf statements from misc.cPeter Hutterer1-3/+0
Leftover from debugging, is not really needeed in a test. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-29include: add BUG_WARN macro for internal bug cases.Peter Hutterer1-0/+7
There are plenty of cases that can only be triggered by a real bug in the server and doing the ErrorF dance manually everywhere is a tad painful and the error message is usually used only to find the spot in the file anyway. Plus, reading BUG_WARN somewhere is a good indicator to the casual reader that this isn't intended behaviour. Note that this is intentionally different to the BUG_ON behaviour on the kernel, we do not FatalError the server. It's just a warning + stacktrace. If the bug is really fatal, call FatalError. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-29Xi: add FreeInputMask functionPeter Hutterer1-2/+10
Does what it says on the box, complements MakeInputMask. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29Xi: add helper functions to alloc/free InputClientPtrsPeter Hutterer1-5/+18
Currently not needed since the InputClientRec is a self-contained struct. As part of the touch rework that won't be the case in the future and a function to allocate/free memory appropriately is required. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29dix: use a single return statement in CheckPassiveGrabsOnWindowPeter Hutterer1-6/+6
No functional change. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29dix: rename GetWindowXI2Mask to WindowXI2MaskIssetPeter Hutterer2-7/+8
And let it return a boolean value, that's all the callers need anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29Xi: use single return code from XIPassiveGrabDevicePeter Hutterer1-16/+20
Some failures returned status but the actual return code was "ret". Use "ret" consistently and move status to the local block is used in. [the goto isn't necessary yet, but for a future patch] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29include: fix mask size calculationPeter Hutterer1-1/+1
Same bug as inputproto-2.0.1-9-gb1149ab, if the XI2LASTEVENT was a multiple of 8, the mask was one bit too short. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-24dmx: Build fix for -Werror=implicit-function-declaration on linuxJeremy Huddleston1-0/+1
Fixes regression introduced by: 6e6d732bac3c21cb85f8e998908f9b393630e5f8 Found-by: Tinderbox Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> CC: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-11-24parser: free val.str after xstrtokenizePaulo Zanoni1-0/+9
After we tokenize val.str, we discard it. This is just one example: 6 bytes in 1 blocks are definitely lost in loss record 24 of 652 at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so) by 0x4D744D: xf86getToken (scan.c:400) by 0x4D75F1: xf86getSubToken (scan.c:462) by 0x4DB060: xf86parseInputClassSection (InputClass.c:145) by 0x4D664C: xf86readConfigFile (read.c:184) by 0x490556: xf86HandleConfigFile (xf86Config.c:2360) by 0x49AA77: InitOutput (xf86Init.c:365) by 0x425A7A: main (main.c:204) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-11-24parser: free val.str after xf86getBoolValuePaulo Zanoni1-0/+6
After we convert the value to a boolean, we discard the string. This is just one example: 3 bytes in 1 blocks are definitely lost in loss record 5 of 657 at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so) by 0x4D744D: xf86getToken (scan.c:400) by 0x4D75F1: xf86getSubToken (scan.c:462) by 0x4DB3E0: xf86parseInputClassSection (InputClass.c:189) by 0x4D664C: xf86readConfigFile (read.c:184) by 0x490556: xf86HandleConfigFile (xf86Config.c:2360) by 0x49AA77: InitOutput (xf86Init.c:365) by 0x425A7A: main (main.c:204) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-11-24parser: free scandir's listPaulo Zanoni1-3/+3
v2: move the free()s to the function that calls scandir 80 bytes in 1 blocks are definitely lost in loss record 411 of 631 at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so) by 0x4C27927: realloc (vgpreload_memcheck-amd64-linux.so) by 0x696A80D: scandir (scandir.c:108) by 0x4D8828: OpenConfigDir (scan.c:854) by 0x4D8A43: xf86openConfigDirFiles (scan.c:952) by 0x49031F: xf86HandleConfigFile (xf86Config.c:2327) by 0x49A9E3: InitOutput (xf86Init.c:365) by 0x425A7A: main (main.c:204) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-24Correctly free config file namesPaulo Zanoni4-20/+20
We call xf86penConfigDirFiles twice, so we overwrite the configDirPath variable, losing the pointer. If we move the pointer management to the upper layer (the function callers), they will be able to call these functions as many times as they want, but they'll have to free those returned values. v2: don't leak inside XWin 4,097 bytes in 1 blocks are definitely lost in loss record 625 of 632 at 0x4C2779D: malloc (in vgpreload_memcheck-amd64-linux.so) by 0x4D7899: DoSubstitution (scan.c:615) by 0x4D87B0: OpenConfigDir (scan.c:845) by 0x4D8A2D: xf86openConfigDirFiles (scan.c:955) by 0x49031F: xf86HandleConfigFile (xf86Config.c:2327) by 0x49A9BF: InitOutput (xf86Init.c:365) by 0x425A7A: main (main.c:204) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-11-24glx: don't leak driConfigsPaulo Zanoni3-9/+34
For dri, dri2 and driswrast. 12,968 (584 direct, 12,384 indirect) bytes in 1 blocks are definitely lost in loss record 569 of 570 at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x7821E3B: driConcatConfigs (utils.c:560) by 0x7827CF2: dri_fill_in_modes (dri_screen.c:224) by 0x782831E: dri_init_screen_helper (dri_screen.c:405) by 0x7826C03: drisw_init_screen (drisw.c:266) by 0x782225F: driCreateNewScreen (drisw_util.c:69) by 0x4826E2: __glXDRIscreenProbe (glxdriswrast.c:451) by 0x4812FA: GlxExtensionInit (glxext.c:327) by 0x41FB14: InitExtensions (miinitext.c:471) by 0x568622: main (main.c:208) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-24glx: don't leak fbconfigsPaulo Zanoni1-0/+9
29,952 (208 direct, 29,744 indirect) bytes in 1 blocks are definitely lost in loss record 573 of 573 at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4829BC: createModeFromConfig (glxdricommon.c:131) by 0x482C09: glxConvertConfigs (glxdricommon.c:185) by 0x482788: __glXDRIscreenProbe (glxdriswrast.c:468) by 0x4812FA: GlxExtensionInit (glxext.c:327) by 0x41FB14: InitExtensions (miinitext.c:471) by 0x568636: main (main.c:208) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-24glx: fix memory leak when destroying screenPaulo Zanoni1-0/+1
1,152 bytes in 1 blocks are definitely lost in loss record 536 of 575 at 0x4C25E84: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x483820: __glXScreenInit (glxscreens.c:357) by 0x48271C: __glXDRIscreenProbe (glxdriswrast.c:469) by 0x4812BE: GlxExtensionInit (glxext.c:327) by 0x41FB14: InitExtensions (miinitext.c:471) by 0x5685AE: main (main.c:208) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23dmx: Build fix for -Werror=implicit-function-declarationJeremy Huddleston6-0/+95
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-23Fix gcc -Wwrite-strings warnings in xf86Modes codeAlan Coopersmith4-8/+8
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Fix gcc -Wwrite-strings warnings in xf86 ddxAlan Coopersmith22-53/+54
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23FindModule: stop copying const char *dirname to char *dirpathAlan Coopersmith1-8/+3
Not needed since 6cf844ab69926b split out the allocation/manipulation into the helper function, leaving FindModule just copying the pointer around, and causing gcc warnings and an unreachable call to free. Also no longer need to store the combined strlen results in dirlen. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Fix gcc -Wwrite-strings warnings in various extensionsAlan Coopersmith16-32/+32
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Fix gcc -Wwrite-strings warnings in XkbGetRulesDfltsAlan Coopersmith1-16/+5
Stop temporarily storing a pointer to a constant literal string in a char *, just to strdup it a few lines later. Fixes gcc -Wwrite-strings warnings: xkbInit.c: In function 'XkbGetRulesDflts': xkbInit.c:121:38: warning: assignment discards qualifiers from pointer target type xkbInit.c:123:23: warning: assignment discards qualifiers from pointer target type xkbInit.c:125:24: warning: assignment discards qualifiers from pointer target type xkbInit.c:127:25: warning: assignment discards qualifiers from pointer target type xkbInit.c:129:25: warning: assignment discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Remove redundant redeclarations of functions in the same header fileAlan Coopersmith3-13/+0
Exposed by recent addition of -Wredundant-decls to default CWARNFLAGS Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23sun_agp: cast key to uintptr_t before casting to (int *)Alan Coopersmith1-1/+1
Matches what linux_agp already does and prevents gcc from throwing up: sun_agp.c: In function 'xf86DeallocateGARTMemory': sun_agp.c:236:40: error: cast to pointer from integer of different size Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Mark XKB char * as const to clean up gcc -Wwrite-strings warningsAlan Coopersmith8-22/+22
Cleans up around 120 warnings from this set Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Mark arguments to fopen/popen/system wrappers as const char *Alan Coopersmith2-6/+6
Silencing more gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Reduce unnecessary string copying in xkbtext routinesAlan Coopersmith1-10/+8
Instead of using sprintf to copy a static string to a local buffer, just to pass it to TryCopyStr, pass the static string to TryCopyStr directly, as is already done in other parts of this code. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert a bunch of sprintf to snprintf callsAlan Coopersmith20-115/+119
This batch is the straightforward set - others are more complex and need more analysis to determine right size to pass. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Remove xf86FormatPciBusNumber from API, inline the one place its usedAlan Coopersmith2-12/+6
Found no calls from current driver modules Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Move DoShowOptions to xf86Configure.c, delete xf86ShowOpts.cAlan Coopersmith3-123/+52
Gets rid of duplicate static copy of optionTypeToString by putting both callers of that helper function in the same source file. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Remove bad code from DoShowOptions (Xorg -showopts handler)Alan Coopersmith1-10/+2
When we want to print a string, it's okay to just print it. We don't need to first allocate a buffer 2 bytes bigger than the string, copy the entire string unmodified to the buffer, print the buffer, and then leak the buffer (though we AbortDDX 8 lines later, and then just in case we survived that, call exit as well, so the leak is short lived, just oh so pointless). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert glx/single2.c:DoGetString() to use asprintf()Alan Coopersmith1-3/+1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23LogVMessageVerb: Fix const mismatch warningAlan Coopersmith1-1/+1
"log.c", line 382: warning: assignment type mismatch: pointer to char "=" pointer to const char Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23AuthAudit: clean up string handling callsAlan Coopersmith1-6/+5
The extra "out" pointer to redirect writes to the array isn't needed since the removal of LBX (commit a9ed5a87902a), and eliminating it allows more logical use of sizeof(addr) in length-checked strlcpy & snprintf calls to write to it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Remove unnecessary variable rtrn in XkbKeysymTextAlan Coopersmith1-4/+4
Also removes even more unnecessary use of variable assignment inside function arguments. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-11-23Make XIGetKnownProperty take a const char * argumentAlan Coopersmith2-2/+2
Now that MakeAtom takes const char *, so can XIGetKnownProperty. Clears 71 warnings from gcc -Wwrite-strings of the form: devices.c:145:5: warning: passing argument 1 of 'XIGetKnownProperty' discards qualifiers from pointer target type ../include/exevents.h:128:23: note: expected 'char *' but argument is of type 'const char *' Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-23Convert ProcRenderQueryFilters to use memcpy instead of strncpyAlan Coopersmith1-2/+2
We just got the string length with strlen, might as well use it to copy the whole string quickly instead of checking each character a second time to see if it's 0 or not. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert DetermineClientCmd to use strdup instead of malloc+strncpyAlan Coopersmith1-7/+1
*cmdname is initialized to NULL earlier in the function, so it's okay to overwrite it with NULL if strdup fails, don't need that extra check. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Convert dmxSetDefaultFontPath to use strdup instead of malloc+strncpyAlan Coopersmith1-7/+4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>