projects
/
platform
/
upstream
/
elfutils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 0.160
[platform/upstream/elfutils.git]
/
libelf
/
gelf_update_rel.c
diff --git
a/libelf/gelf_update_rel.c
b/libelf/gelf_update_rel.c
index
d13e402
..
14f62e9
100644
(file)
--- a/
libelf/gelf_update_rel.c
+++ b/
libelf/gelf_update_rel.c
@@
-1,5
+1,5
@@
/* Update REL relocation information at given index.
/* Update REL relocation information at given index.
- Copyright (C) 2000, 2001, 2002 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002
, 2005, 2009, 2014
Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
@@
-47,12
+47,6
@@
gelf_update_rel (Elf_Data *dst, int ndx, GElf_Rel *src)
if (dst == NULL)
return 0;
if (dst == NULL)
return 0;
- if (unlikely (ndx < 0))
- {
- __libelf_seterrno (ELF_E_INVALID_INDEX);
- return 0;
- }
-
if (unlikely (data_scn->d.d_type != ELF_T_REL))
{
/* The type of the data better should match. */
if (unlikely (data_scn->d.d_type != ELF_T_REL))
{
/* The type of the data better should match. */
@@
-78,7
+72,7
@@
gelf_update_rel (Elf_Data *dst, int ndx, GElf_Rel *src)
}
/* Check whether we have to resize the data buffer. */
}
/* Check whether we have to resize the data buffer. */
- if (
unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size
))
+ if (
INVALID_NDX (ndx, Elf32_Rel, &data_scn->d
))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
@@
-93,7
+87,7
@@
gelf_update_rel (Elf_Data *dst, int ndx, GElf_Rel *src)
else
{
/* Check whether we have to resize the data buffer. */
else
{
/* Check whether we have to resize the data buffer. */
- if (
unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size
))
+ if (
INVALID_NDX (ndx, Elf64_Rel, &data_scn->d
))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;