* [Qemu-devel] [PATCH] OHW OF_setprop() zero-sized property
@ 2005-02-24 4:34 Thayne Harbaugh
0 siblings, 0 replies; only message in thread
From: Thayne Harbaugh @ 2005-02-24 4:34 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 350 bytes --]
The current implementation of OF_setprop() doesn't allow for value-less
or zero-sized properties to be set. This breaks Linux 2.6 frame buffer
since arch/ppc/syslib/prom_init.c:check_display() marks displays with a
value-less property "linux,opened" and then
drivers/video/offb.c:offb_init() later finds these displays marked with
"linux,opened".
[-- Attachment #2: OpenHackWare-0.4-pre1c-OF_setprop_zero_size.patch --]
[-- Type: text/x-patch, Size: 950 bytes --]
Index: src/of.c
===================================================================
--- src/of.c (revision 90)
+++ src/of.c (working copy)
@@ -3769,7 +3776,7 @@
static void OF_setprop (OF_env_t *OF_env)
{
unsigned char name[OF_NAMELEN_MAX], *namep;
- unsigned char *value, *buffer;
+ unsigned char *value = NULL, *buffer;
OF_node_t *node;
OF_prop_t *prop;
uint32_t phandle;
@@ -3780,12 +3787,15 @@
ERROR("Cannot get pack %04x\n", phandle);
return;
}
- value = malloc(len);
- if (value == NULL) {
+ if (len && !(value = malloc(len))) {
pushd(OF_env, -1);
ERROR("%s: Cannot alloc property\n", __func__);
return;
}
+ if (!len && value) {
+ pushd(OF_env, -1);
+ ERROR("%s: NULL buffer for non-zero sized property!\n", __func__);
+ }
for (i = 0; i < len; i++)
value[i] = buffer[i];
prop = OF_property_set(OF_env, node, name, value, len);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-02-24 5:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-24 4:34 [Qemu-devel] [PATCH] OHW OF_setprop() zero-sized property Thayne Harbaugh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).