mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-07 13:15:12 +02:00
geoip: remove redundant casts
This commit is contained in:
@@ -80,7 +80,7 @@ get_country_subnets(u_int16_t cc, u_int32_t *count)
|
|||||||
|
|
||||||
stat("/var/geoip/geoipdb.idx", &buf);
|
stat("/var/geoip/geoipdb.idx", &buf);
|
||||||
idxsz = buf.st_size/sizeof(struct geoip_index);
|
idxsz = buf.st_size/sizeof(struct geoip_index);
|
||||||
index = (struct geoip_index *)malloc(buf.st_size);
|
index = malloc(buf.st_size);
|
||||||
|
|
||||||
fread(index, buf.st_size, 1, ixfd);
|
fread(index, buf.st_size, 1, ixfd);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ get_country_subnets(u_int16_t cc, u_int32_t *count)
|
|||||||
|
|
||||||
fread(&db_nsubnets, sizeof(u_int16_t), 1, dbfd);
|
fread(&db_nsubnets, sizeof(u_int16_t), 1, dbfd);
|
||||||
|
|
||||||
subnets = (struct geoip_subnet*)malloc(db_nsubnets * sizeof(struct geoip_subnet));
|
subnets = malloc(db_nsubnets * sizeof(struct geoip_subnet));
|
||||||
|
|
||||||
if (!subnets)
|
if (!subnets)
|
||||||
exit_error(OTHER_PROBLEM,
|
exit_error(OTHER_PROBLEM,
|
||||||
|
@@ -32,15 +32,14 @@ static spinlock_t geoip_lock = SPIN_LOCK_UNLOCKED;
|
|||||||
|
|
||||||
static struct geoip_info *add_node(struct geoip_info *memcpy)
|
static struct geoip_info *add_node(struct geoip_info *memcpy)
|
||||||
{
|
{
|
||||||
struct geoip_info *p =
|
struct geoip_info *p = kmalloc(sizeof(struct geoip_info), GFP_KERNEL);
|
||||||
(struct geoip_info *)kmalloc(sizeof(struct geoip_info), GFP_KERNEL);
|
|
||||||
|
|
||||||
struct geoip_subnet *s;
|
struct geoip_subnet *s;
|
||||||
|
|
||||||
if ((p == NULL) || (copy_from_user(p, memcpy, sizeof(struct geoip_info)) != 0))
|
if ((p == NULL) || (copy_from_user(p, memcpy, sizeof(struct geoip_info)) != 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
s = (struct geoip_subnet *)kmalloc(p->count * sizeof(struct geoip_subnet), GFP_KERNEL);
|
s = kmalloc(p->count * sizeof(struct geoip_subnet), GFP_KERNEL);
|
||||||
if ((s == NULL) || (copy_from_user(s, p->subnets, p->count * sizeof(struct geoip_subnet)) != 0))
|
if ((s == NULL) || (copy_from_user(s, p->subnets, p->count * sizeof(struct geoip_subnet)) != 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -109,7 +108,7 @@ static bool xt_geoip_mt(const struct sk_buff *skb,
|
|||||||
unsigned int protoff,
|
unsigned int protoff,
|
||||||
bool *hotdrop)
|
bool *hotdrop)
|
||||||
{
|
{
|
||||||
const struct xt_geoip_match_info *info = (void*)matchinfo;
|
const struct xt_geoip_match_info *info = matchinfo;
|
||||||
const struct geoip_info *node; /* This keeps the code sexy */
|
const struct geoip_info *node; /* This keeps the code sexy */
|
||||||
const struct iphdr *iph = ip_hdr(skb);
|
const struct iphdr *iph = ip_hdr(skb);
|
||||||
u_int32_t ip, i, j;
|
u_int32_t ip, i, j;
|
||||||
@@ -146,7 +145,7 @@ static bool xt_geoip_mt_checkentry(const char *tablename,
|
|||||||
unsigned int hook_mas)
|
unsigned int hook_mas)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct xt_geoip_match_info *info = (void *)matchinfo;
|
struct xt_geoip_match_info *info = matchinfo;
|
||||||
struct geoip_info *node;
|
struct geoip_info *node;
|
||||||
u_int8_t i;
|
u_int8_t i;
|
||||||
|
|
||||||
@@ -176,7 +175,7 @@ static bool xt_geoip_mt_checkentry(const char *tablename,
|
|||||||
static void xt_geoip_mt_destroy(const struct xt_match *matcn,
|
static void xt_geoip_mt_destroy(const struct xt_match *matcn,
|
||||||
void *matchinfo)
|
void *matchinfo)
|
||||||
{
|
{
|
||||||
struct xt_geoip_match_info *info = (void *)matchinfo;
|
struct xt_geoip_match_info *info = matchinfo;
|
||||||
struct geoip_info *node; /* this keeps the code sexy */
|
struct geoip_info *node; /* this keeps the code sexy */
|
||||||
u_int8_t i;
|
u_int8_t i;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user