From: Thayne Harbaugh <thayne@realmsys.com>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] OHW OF_setprop() zero-sized property
Date: Wed, 23 Feb 2005 21:34:53 -0700 [thread overview]
Message-ID: <1109219693.29649.4.camel@localhost.localdomain> (raw)
[-- 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);
reply other threads:[~2005-02-24 5:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1109219693.29649.4.camel@localhost.localdomain \
--to=thayne@realmsys.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).