netfilter: Remove unnecessary cast on void pointer
The following Coccinelle script was used to detect this: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T*)x)->f | - (T*) e ) Unnecessary parantheses are also remove. Signed-off-by: simran singhal <singhalsimran0@gmail.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:

committed by
Pablo Neira Ayuso

parent
dedb67c4b4
commit
68ad546aef
@@ -411,7 +411,7 @@ mark_source_chains(const struct xt_table_info *newinfo,
|
||||
to 0 as we leave), and comefrom to save source hook bitmask */
|
||||
for (hook = 0; hook < NF_INET_NUMHOOKS; hook++) {
|
||||
unsigned int pos = newinfo->hook_entry[hook];
|
||||
struct ip6t_entry *e = (struct ip6t_entry *)(entry0 + pos);
|
||||
struct ip6t_entry *e = entry0 + pos;
|
||||
|
||||
if (!(valid_hooks & (1 << hook)))
|
||||
continue;
|
||||
@@ -453,14 +453,12 @@ mark_source_chains(const struct xt_table_info *newinfo,
|
||||
if (pos == oldpos)
|
||||
goto next;
|
||||
|
||||
e = (struct ip6t_entry *)
|
||||
(entry0 + pos);
|
||||
e = entry0 + pos;
|
||||
} while (oldpos == pos + e->next_offset);
|
||||
|
||||
/* Move along one */
|
||||
size = e->next_offset;
|
||||
e = (struct ip6t_entry *)
|
||||
(entry0 + pos + size);
|
||||
e = entry0 + pos + size;
|
||||
if (pos + size >= newinfo->size)
|
||||
return 0;
|
||||
e->counters.pcnt = pos;
|
||||
@@ -475,16 +473,14 @@ mark_source_chains(const struct xt_table_info *newinfo,
|
||||
if (!xt_find_jump_offset(offsets, newpos,
|
||||
newinfo->number))
|
||||
return 0;
|
||||
e = (struct ip6t_entry *)
|
||||
(entry0 + newpos);
|
||||
e = entry0 + newpos;
|
||||
} else {
|
||||
/* ... this is a fallthru */
|
||||
newpos = pos + e->next_offset;
|
||||
if (newpos >= newinfo->size)
|
||||
return 0;
|
||||
}
|
||||
e = (struct ip6t_entry *)
|
||||
(entry0 + newpos);
|
||||
e = entry0 + newpos;
|
||||
e->counters.pcnt = pos;
|
||||
pos = newpos;
|
||||
}
|
||||
@@ -863,7 +859,7 @@ copy_entries_to_user(unsigned int total_size,
|
||||
const struct xt_entry_match *m;
|
||||
const struct xt_entry_target *t;
|
||||
|
||||
e = (struct ip6t_entry *)(loc_cpu_entry + off);
|
||||
e = loc_cpu_entry + off;
|
||||
if (copy_to_user(userptr + off, e, sizeof(*e))) {
|
||||
ret = -EFAULT;
|
||||
goto free_counters;
|
||||
@@ -1258,7 +1254,7 @@ compat_copy_entry_to_user(struct ip6t_entry *e, void __user **dstptr,
|
||||
int ret = 0;
|
||||
|
||||
origsize = *size;
|
||||
ce = (struct compat_ip6t_entry __user *)*dstptr;
|
||||
ce = *dstptr;
|
||||
if (copy_to_user(ce, e, sizeof(struct ip6t_entry)) != 0 ||
|
||||
copy_to_user(&ce->counters, &counters[i],
|
||||
sizeof(counters[i])) != 0)
|
||||
@@ -1394,7 +1390,7 @@ compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr,
|
||||
struct xt_entry_match *ematch;
|
||||
|
||||
origsize = *size;
|
||||
de = (struct ip6t_entry *)*dstptr;
|
||||
de = *dstptr;
|
||||
memcpy(de, e, sizeof(struct ip6t_entry));
|
||||
memcpy(&de->counters, &e->counters, sizeof(e->counters));
|
||||
|
||||
|
Reference in New Issue
Block a user