diff options
author | Nathan Fontenot <nfont@linux.vnet.ibm.com> | 2013-04-24 01:49:36 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-04-26 02:08:19 -0400 |
commit | 2e9b7b02a3bbe5070495bce7107ea3d1d8c3ef65 (patch) | |
tree | f273197a2e009468561643d64ba3a2df5a46f51e /arch/powerpc/platforms | |
parent | 762ec15707518ad06531841df73ded857886f253 (diff) |
powerpc/pseries: Correct buffer parsing in update_dt_node()
Correct parsing of the buffer returned from ibm,update-properties. The first
element is a length and the path to the property which is slightly different
from the list of properties in the buffer so we need to specifically
handle this.
Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/mobility.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c index 4c184ceb2450..3d01eee9ffb1 100644 --- a/arch/powerpc/platforms/pseries/mobility.c +++ b/arch/powerpc/platforms/pseries/mobility.c | |||
@@ -134,6 +134,7 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
134 | char *prop_data; | 134 | char *prop_data; |
135 | char *rtas_buf; | 135 | char *rtas_buf; |
136 | int update_properties_token; | 136 | int update_properties_token; |
137 | u32 vd; | ||
137 | 138 | ||
138 | update_properties_token = rtas_token("ibm,update-properties"); | 139 | update_properties_token = rtas_token("ibm,update-properties"); |
139 | if (update_properties_token == RTAS_UNKNOWN_SERVICE) | 140 | if (update_properties_token == RTAS_UNKNOWN_SERVICE) |
@@ -160,13 +161,24 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
160 | 161 | ||
161 | prop_data = rtas_buf + sizeof(*upwa); | 162 | prop_data = rtas_buf + sizeof(*upwa); |
162 | 163 | ||
163 | for (i = 0; i < upwa->nprops; i++) { | 164 | /* The first element of the buffer is the path of the node |
165 | * being updated in the form of a 8 byte string length | ||
166 | * followed by the string. Skip past this to get to the | ||
167 | * properties being updated. | ||
168 | */ | ||
169 | vd = *prop_data++; | ||
170 | prop_data += vd; | ||
171 | |||
172 | /* The path we skipped over is counted as one of the elements | ||
173 | * returned so start counting at one. | ||
174 | */ | ||
175 | for (i = 1; i < upwa->nprops; i++) { | ||
164 | char *prop_name; | 176 | char *prop_name; |
165 | u32 vd; | ||
166 | 177 | ||
167 | prop_name = prop_data + 1; | 178 | prop_name = prop_data; |
168 | prop_data += strlen(prop_name) + 1; | 179 | prop_data += strlen(prop_name) + 1; |
169 | vd = *prop_data++; | 180 | vd = *(u32 *)prop_data; |
181 | prop_data += sizeof(vd); | ||
170 | 182 | ||
171 | switch (vd) { | 183 | switch (vd) { |
172 | case 0x00000000: | 184 | case 0x00000000: |