Permalink
Browse files

libscf: Don't pass a uint8_t* to scf_read_propvec with pv_aux

When pv_aux is non-0, scf_read_propvec writes a uint64_t to the result.
On both platforms this will stomp memory, on SPARC it will (sometimes)
abort thanks to the bad alignment.

Pass a uint64_t, but continue to return the low 8 bits in our uint8_t
  • Loading branch information...
1 parent 7eeeaed commit 133b60d3b78161cb967c8bd5dfc202fd51bf7aa0 @richlowe committed Apr 27, 2012
Showing with 7 additions and 5 deletions.
  1. +7 −5 usr/src/lib/libscf/common/highlevel.c
@@ -159,8 +159,8 @@ scf_fmri_pg_get_or_add(const char *fmri, const char *pgname,
void
scf_get_boot_config(uint8_t *boot_config)
{
+ uint64_t ret = 0;
assert(boot_config);
- *boot_config = 0;
{
/*
@@ -176,7 +176,7 @@ scf_get_boot_config(uint8_t *boot_config)
scf_propvec_t *prop;
for (prop = ua_boot_config; prop->pv_prop != NULL; prop++)
- prop->pv_ptr = boot_config;
+ prop->pv_ptr = &ret;
prop = NULL;
if (scf_read_propvec(FMRI_BOOT_CONFIG, BOOT_CONFIG_PG_PARAMS,
B_TRUE, ua_boot_config, &prop) != SCF_FAILED) {
@@ -186,10 +186,12 @@ scf_get_boot_config(uint8_t *boot_config)
* Unset both flags if the platform has been
* blacklisted.
*/
- if (scf_is_fb_blacklisted())
- *boot_config &= ~(UA_FASTREBOOT_DEFAULT |
- UA_FASTREBOOT_ONPANIC);
+ if (scf_is_fb_blacklisted()) {
+ *boot_config = 0;
+ return;
+ }
#endif /* __x86 */
+ *boot_config = (uint8_t)ret;
return;
}
#if defined(FASTREBOOT_DEBUG)

0 comments on commit 133b60d

Please sign in to comment.