1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-15 20:58:13 +01:00

Get rid of some bogus checks.

Greetings,

Attached patch is rather on the obvious side:
- rs1 can't be NULL since it's assigned on previous line
- rs_new never returns NULL, and if it ever did, we'd crash on memcpy that
  preceeds the NULL check.

Tested on Linux/x86_64 with no regressions.

Thanks,
--
Paul Pluzhnikov
This commit is contained in:
Paul Pluzhnikov 2009-11-18 17:16:47 -08:00 committed by Arun Sharma
parent f88e949d16
commit f958b9dc4f

View file

@ -784,7 +784,7 @@ HIDDEN int
dwarf_find_save_locs (struct dwarf_cursor *c) dwarf_find_save_locs (struct dwarf_cursor *c)
{ {
dwarf_state_record_t sr; dwarf_state_record_t sr;
dwarf_reg_state_t *rs, *rs1; dwarf_reg_state_t *rs;
struct dwarf_rs_cache *cache; struct dwarf_rs_cache *cache;
int ret = 0; int ret = 0;
intrmask_t saved_mask; intrmask_t saved_mask;
@ -809,18 +809,8 @@ dwarf_find_save_locs (struct dwarf_cursor *c)
if ((ret = create_state_record_for (c, &sr, c->ip)) < 0) if ((ret = create_state_record_for (c, &sr, c->ip)) < 0)
goto out; goto out;
rs1 = &sr.rs_current; rs = rs_new (cache, c);
if (rs1) memcpy(rs, &sr.rs_current, offsetof(struct dwarf_reg_state, ip));
{
rs = rs_new (cache, c);
memcpy(rs, rs1, offsetof(struct dwarf_reg_state, ip));
if (!rs)
{
Dprintf ("%s: failed to create unwind rs\n", __FUNCTION__);
ret = -UNW_EUNSPEC;
goto out;
}
}
cache->buckets[c->prev_rs].hint = rs - cache->buckets; cache->buckets[c->prev_rs].hint = rs - cache->buckets;
c->hint = rs->hint; c->hint = rs->hint;