diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-07-01 14:04:44 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-07-01 14:04:44 +1000 |
commit | dd72c49c4c7ec924952bd5073e364d8c1417ccfd (patch) | |
tree | 6bdd9024e534de5e61dbebdf99eb0233c7610917 /hw | |
parent | f469c1f4df925f207fea4b727e5c0561af88bd9b (diff) | |
parent | 4153f5d6a76736f8ba9500880d8f0c1034bdd1b6 (diff) | |
download | skiboot-dd72c49c4c7ec924952bd5073e364d8c1417ccfd.zip skiboot-dd72c49c4c7ec924952bd5073e364d8c1417ccfd.tar.gz skiboot-dd72c49c4c7ec924952bd5073e364d8c1417ccfd.tar.bz2 |
Merge remote-tracking branch 'github/master' into mergeback
Diffstat (limited to 'hw')
-rw-r--r-- | hw/fsp/fsp-epow.c | 2 | ||||
-rw-r--r-- | hw/fsp/fsp-leds.c | 2 | ||||
-rw-r--r-- | hw/ipmi/test/run-fru.c | 31 | ||||
-rw-r--r-- | hw/p7ioc-phb.c | 3 |
4 files changed, 35 insertions, 3 deletions
diff --git a/hw/fsp/fsp-epow.c b/hw/fsp/fsp-epow.c index 2a5aa85..79171c5 100644 --- a/hw/fsp/fsp-epow.c +++ b/hw/fsp/fsp-epow.c @@ -14,7 +14,7 @@ * limitations under the License. */ -/* FSP Early Power Off Warning (EPOW) support */ +/* FSP Environmental and Power Warnings (EPOW) support */ #define pr_fmt(fmt) "FSP-EPOW: " fmt diff --git a/hw/fsp/fsp-leds.c b/hw/fsp/fsp-leds.c index 82be37a..877aca1 100644 --- a/hw/fsp/fsp-leds.c +++ b/hw/fsp/fsp-leds.c @@ -683,7 +683,7 @@ static int queue_led_state_change(char *loc_code, u8 command, } /* Save the request */ - strncpy(cmd->loc_code, loc_code, LOC_CODE_SIZE); + strncpy(cmd->loc_code, loc_code, LOC_CODE_SIZE - 1); cmd->command = command; cmd->state = state; cmd->cmd_src = cmd_src; diff --git a/hw/ipmi/test/run-fru.c b/hw/ipmi/test/run-fru.c index 423b3c7..f548311 100644 --- a/hw/ipmi/test/run-fru.c +++ b/hw/ipmi/test/run-fru.c @@ -65,6 +65,23 @@ int main(void) .serial_no = (char *) "12345", .asset_tag = (char *) "abcd", }; + struct product_info invalid_info = { + .manufacturer = (char *) "I", + .product = (char *) "skiboot", + .part_no = (char *) "hello", + .version = (char *) "12345", + .serial_no = (char *) "12345", + .asset_tag = (char *) "abcd", + }; + struct product_info invalid_info2 = { + .manufacturer = (char *) "IBM", + .product = (char *) "skiboot", + .part_no = (char *) "this is a really long string that's more" + "than 32 characters, because it turns out that's invalid.", + .version = (char *) "12345", + .serial_no = (char *) "12345", + .asset_tag = (char *) "abcd", + }; buf = malloc(256); @@ -78,8 +95,22 @@ int main(void) assert(fru_fill_product_info(buf, &info, 39) < 0); memset(buf, 0, 256); + len = fru_fill_product_info(buf, &invalid_info, 40); + assert(len == OPAL_PARAMETER); + + memset(buf, 0, 256); + len = fru_fill_product_info(buf, &invalid_info2, 256); + assert(len == OPAL_PARAMETER); + + memset(buf, 0, 256); assert(fru_add(buf, 256) > 0); + memset(buf, 0, 256); + assert(fru_add(buf, 1) == OPAL_PARAMETER); + + memset(buf, 0, 256); + assert(fru_add(buf, 65) == OPAL_PARAMETER); + free(buf); return 0; diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c index 89592c4..0b37993 100644 --- a/hw/p7ioc-phb.c +++ b/hw/p7ioc-phb.c @@ -1408,6 +1408,7 @@ static int64_t p7ioc_err_inject_io32(struct p7ioc_phb *p, uint32_t pe_no, uint64_t ctrl = PHB_PAPR_ERR_INJ_CTL_OUTB; int32_t index; + a = 0x0ull; addr = 0x0ull; prefer = 0x0ull; for (index = 0; index < 128; index++) { @@ -1849,7 +1850,7 @@ static int64_t p7ioc_map_pe_dma_window(struct phb *phb, uint16_t pe_number, uint64_t dma_window_size; uint64_t *cache_lo, *cache_hi; - if (pe_number > 127 || window_id > 255 || tce_levels != 1) + if (pe_number > 127 || window_id > 127 || tce_levels != 1) return OPAL_PARAMETER; cache_lo = &p->tve_lo_cache[window_id]; cache_hi = &p->tve_hi_cache[window_id]; |