idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
40,600 | static enum rdma_ch_state srpt_get_ch_state(struct srpt_rdma_ch *ch)
{
unsigned long flags;
enum rdma_ch_state state;
spin_lock_irqsave(&ch->spinlock, flags);
state = ch->state;
spin_unlock_irqrestore(&ch->spinlock, flags);
return state;
}
| DoS | 0 | static enum rdma_ch_state srpt_get_ch_state(struct srpt_rdma_ch *ch)
{
unsigned long flags;
enum rdma_ch_state state;
spin_lock_irqsave(&ch->spinlock, flags);
state = ch->state;
spin_unlock_irqrestore(&ch->spinlock, flags);
return state;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,601 | static void srpt_get_class_port_info(struct ib_dm_mad *mad)
{
struct ib_class_port_info *cif;
cif = (struct ib_class_port_info *)mad->data;
memset(cif, 0, sizeof *cif);
cif->base_version = 1;
cif->class_version = 1;
cif->resp_time_value = 20;
mad->mad_hdr.status = 0;
}
| DoS | 0 | static void srpt_get_class_port_info(struct ib_dm_mad *mad)
{
struct ib_class_port_info *cif;
cif = (struct ib_class_port_info *)mad->data;
memset(cif, 0, sizeof *cif);
cif->base_version = 1;
cif->class_version = 1;
cif->resp_time_value = 20;
mad->mad_hdr.status = 0;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,602 | static enum srpt_command_state srpt_get_cmd_state(struct srpt_send_ioctx *ioctx)
{
enum srpt_command_state state;
unsigned long flags;
BUG_ON(!ioctx);
spin_lock_irqsave(&ioctx->spinlock, flags);
state = ioctx->state;
spin_unlock_irqrestore(&ioctx->spinlock, flags);
return state;
}
| DoS | 0 | static enum srpt_command_state srpt_get_cmd_state(struct srpt_send_ioctx *ioctx)
{
enum srpt_command_state state;
unsigned long flags;
BUG_ON(!ioctx);
spin_lock_irqsave(&ioctx->spinlock, flags);
state = ioctx->state;
spin_unlock_irqrestore(&ioctx->spinlock, flags);
return state;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,603 | static int srpt_get_desc_tbl(struct srpt_send_ioctx *ioctx,
struct srp_cmd *srp_cmd,
enum dma_data_direction *dir, u64 *data_len)
{
struct srp_indirect_buf *idb;
struct srp_direct_buf *db;
unsigned add_cdb_offset;
int ret;
/*
* The pointer computations below will only be compiled correctly
* i... | DoS | 0 | static int srpt_get_desc_tbl(struct srpt_send_ioctx *ioctx,
struct srp_cmd *srp_cmd,
enum dma_data_direction *dir, u64 *data_len)
{
struct srp_indirect_buf *idb;
struct srp_direct_buf *db;
unsigned add_cdb_offset;
int ret;
/*
* The pointer computations below will only be compiled correctly
* i... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,604 | static char *srpt_get_fabric_wwn(struct se_portal_group *tpg)
{
struct srpt_port *sport = container_of(tpg, struct srpt_port, port_tpg_1);
return sport->port_guid;
}
| DoS | 0 | static char *srpt_get_fabric_wwn(struct se_portal_group *tpg)
{
struct srpt_port *sport = container_of(tpg, struct srpt_port, port_tpg_1);
return sport->port_guid;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,605 | static void srpt_get_ioc(struct srpt_port *sport, u32 slot,
struct ib_dm_mad *mad)
{
struct srpt_device *sdev = sport->sdev;
struct ib_dm_ioc_profile *iocp;
iocp = (struct ib_dm_ioc_profile *)mad->data;
if (!slot || slot > 16) {
mad->mad_hdr.status
= cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
return;
}... | DoS | 0 | static void srpt_get_ioc(struct srpt_port *sport, u32 slot,
struct ib_dm_mad *mad)
{
struct srpt_device *sdev = sport->sdev;
struct ib_dm_ioc_profile *iocp;
iocp = (struct ib_dm_ioc_profile *)mad->data;
if (!slot || slot > 16) {
mad->mad_hdr.status
= cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
return;
}... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,606 | static void srpt_get_iou(struct ib_dm_mad *mad)
{
struct ib_dm_iou_info *ioui;
u8 slot;
int i;
ioui = (struct ib_dm_iou_info *)mad->data;
ioui->change_id = cpu_to_be16(1);
ioui->max_controllers = 16;
/* set present for slot 1 and empty for the rest */
srpt_set_ioc(ioui->controller_list, 1, 1);
for (i = 1, sl... | DoS | 0 | static void srpt_get_iou(struct ib_dm_mad *mad)
{
struct ib_dm_iou_info *ioui;
u8 slot;
int i;
ioui = (struct ib_dm_iou_info *)mad->data;
ioui->change_id = cpu_to_be16(1);
ioui->max_controllers = 16;
/* set present for slot 1 and empty for the rest */
srpt_set_ioc(ioui->controller_list, 1, 1);
for (i = 1, sl... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,607 | static void srpt_get_svc_entries(u64 ioc_guid,
u16 slot, u8 hi, u8 lo, struct ib_dm_mad *mad)
{
struct ib_dm_svc_entries *svc_entries;
WARN_ON(!ioc_guid);
if (!slot || slot > 16) {
mad->mad_hdr.status
= cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
return;
}
if (slot > 2 || lo > hi || hi > 1) {
mad->m... | DoS | 0 | static void srpt_get_svc_entries(u64 ioc_guid,
u16 slot, u8 hi, u8 lo, struct ib_dm_mad *mad)
{
struct ib_dm_svc_entries *svc_entries;
WARN_ON(!ioc_guid);
if (!slot || slot > 16) {
mad->mad_hdr.status
= cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
return;
}
if (slot > 2 || lo > hi || hi > 1) {
mad->m... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,608 | static u16 srpt_get_tag(struct se_portal_group *tpg)
{
return 1;
}
| DoS | 0 | static u16 srpt_get_tag(struct se_portal_group *tpg)
{
return 1;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,609 | static int srpt_get_u64_x(char *buffer, struct kernel_param *kp)
{
return sprintf(buffer, "0x%016llx", *(u64 *)kp->arg);
}
| DoS | 0 | static int srpt_get_u64_x(char *buffer, struct kernel_param *kp)
{
return sprintf(buffer, "0x%016llx", *(u64 *)kp->arg);
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,610 | static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
struct srpt_recv_ioctx *recv_ioctx,
struct srpt_send_ioctx *send_ioctx)
{
struct se_cmd *cmd;
struct srp_cmd *srp_cmd;
uint64_t unpacked_lun;
u64 data_len;
enum dma_data_direction dir;
sense_reason_t ret;
int rc;
BUG_ON(!send_ioctx);
srp_cmd = r... | DoS | 0 | static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
struct srpt_recv_ioctx *recv_ioctx,
struct srpt_send_ioctx *send_ioctx)
{
struct se_cmd *cmd;
struct srp_cmd *srp_cmd;
uint64_t unpacked_lun;
u64 data_len;
enum dma_data_direction dir;
sense_reason_t ret;
int rc;
BUG_ON(!send_ioctx);
srp_cmd = r... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,611 | static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
struct srpt_recv_ioctx *recv_ioctx,
struct srpt_send_ioctx *send_ioctx)
{
struct srp_cmd *srp_cmd;
enum rdma_ch_state ch_state;
BUG_ON(!ch);
BUG_ON(!recv_ioctx);
ib_dma_sync_single_for_cpu(ch->sport->sdev->device,
recv_ioctx->ioct... | DoS | 0 | static void srpt_handle_new_iu(struct srpt_rdma_ch *ch,
struct srpt_recv_ioctx *recv_ioctx,
struct srpt_send_ioctx *send_ioctx)
{
struct srp_cmd *srp_cmd;
enum rdma_ch_state ch_state;
BUG_ON(!ch);
BUG_ON(!recv_ioctx);
ib_dma_sync_single_for_cpu(ch->sport->sdev->device,
recv_ioctx->ioct... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,612 | static int __init srpt_init_module(void)
{
int ret;
ret = -EINVAL;
if (srp_max_req_size < MIN_MAX_REQ_SIZE) {
pr_err("invalid value %d for kernel module parameter"
" srp_max_req_size -- must be at least %d.\n",
srp_max_req_size, MIN_MAX_REQ_SIZE);
goto out;
}
if (srpt_srq_size < MIN_SRPT_SR... | DoS | 0 | static int __init srpt_init_module(void)
{
int ret;
ret = -EINVAL;
if (srp_max_req_size < MIN_MAX_REQ_SIZE) {
pr_err("invalid value %d for kernel module parameter"
" srp_max_req_size -- must be at least %d.\n",
srp_max_req_size, MIN_MAX_REQ_SIZE);
goto out;
}
if (srpt_srq_size < MIN_SRPT_SR... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,613 | static int srpt_init_nodeacl(struct se_node_acl *se_nacl, const char *name)
{
u8 i_port_id[16];
if (srpt_parse_i_port_id(i_port_id, name) < 0) {
pr_err("invalid initiator port ID %s\n", name);
return -EINVAL;
}
return 0;
}
| DoS | 0 | static int srpt_init_nodeacl(struct se_node_acl *se_nacl, const char *name)
{
u8 i_port_id[16];
if (srpt_parse_i_port_id(i_port_id, name) < 0) {
pr_err("invalid initiator port ID %s\n", name);
return -EINVAL;
}
return 0;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,614 | static struct srpt_port *srpt_lookup_port(const char *name)
{
struct srpt_port *sport;
spin_lock(&srpt_dev_lock);
sport = __srpt_lookup_port(name);
spin_unlock(&srpt_dev_lock);
return sport;
}
| DoS | 0 | static struct srpt_port *srpt_lookup_port(const char *name)
{
struct srpt_port *sport;
spin_lock(&srpt_dev_lock);
sport = __srpt_lookup_port(name);
spin_unlock(&srpt_dev_lock);
return sport;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,615 | static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
struct ib_mad_send_buf *send_buf,
struct ib_mad_recv_wc *mad_wc)
{
struct srpt_port *sport = (struct srpt_port *)mad_agent->context;
struct ib_ah *ah;
struct ib_mad_send_buf *rsp;
struct ib_dm_mad *dm_mad;
if (!mad_wc || !mad_wc->recv_b... | DoS | 0 | static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
struct ib_mad_send_buf *send_buf,
struct ib_mad_recv_wc *mad_wc)
{
struct srpt_port *sport = (struct srpt_port *)mad_agent->context;
struct ib_ah *ah;
struct ib_mad_send_buf *rsp;
struct ib_dm_mad *dm_mad;
if (!mad_wc || !mad_wc->recv_b... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,616 | static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent,
struct ib_mad_send_wc *mad_wc)
{
ib_destroy_ah(mad_wc->send_buf->ah);
ib_free_send_mad(mad_wc->send_buf);
}
| DoS | 0 | static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent,
struct ib_mad_send_wc *mad_wc)
{
ib_destroy_ah(mad_wc->send_buf->ah);
ib_free_send_mad(mad_wc->send_buf);
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,617 | static struct se_portal_group *srpt_make_tpg(struct se_wwn *wwn,
struct config_group *group,
const char *name)
{
struct srpt_port *sport = container_of(wwn, struct srpt_port, port_wwn);
int res;
/* Initialize sport->port_wwn and sport->port_tpg_1 */
res = core_tpg_register(&sport->port_wwn, &sp... | DoS | 0 | static struct se_portal_group *srpt_make_tpg(struct se_wwn *wwn,
struct config_group *group,
const char *name)
{
struct srpt_port *sport = container_of(wwn, struct srpt_port, port_wwn);
int res;
/* Initialize sport->port_wwn and sport->port_tpg_1 */
res = core_tpg_register(&sport->port_wwn, &sp... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,618 | static struct se_wwn *srpt_make_tport(struct target_fabric_configfs *tf,
struct config_group *group,
const char *name)
{
struct srpt_port *sport;
int ret;
sport = srpt_lookup_port(name);
pr_debug("make_tport(%s)\n", name);
ret = -EINVAL;
if (!sport)
goto err;
return &sport->port_wwn;
err... | DoS | 0 | static struct se_wwn *srpt_make_tport(struct target_fabric_configfs *tf,
struct config_group *group,
const char *name)
{
struct srpt_port *sport;
int ret;
sport = srpt_lookup_port(name);
pr_debug("make_tport(%s)\n", name);
ret = -EINVAL;
if (!sport)
goto err;
return &sport->port_wwn;
err... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,619 | static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx)
{
struct ib_device *dev = ch->sport->sdev->device;
struct se_cmd *cmd;
struct scatterlist *sg, *sg_orig;
int sg_cnt;
enum dma_data_direction dir;
struct ib_rdma_wr *riu;
struct srp_direct_buf *db;
dma_addr_t dma_addr;
... | DoS | 0 | static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx)
{
struct ib_device *dev = ch->sport->sdev->device;
struct se_cmd *cmd;
struct scatterlist *sg, *sg_orig;
int sg_cnt;
enum dma_data_direction dir;
struct ib_rdma_wr *riu;
struct srp_direct_buf *db;
dma_addr_t dma_addr;
... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,620 | static void srpt_mgmt_method_get(struct srpt_port *sp, struct ib_mad *rq_mad,
struct ib_dm_mad *rsp_mad)
{
u16 attr_id;
u32 slot;
u8 hi, lo;
attr_id = be16_to_cpu(rq_mad->mad_hdr.attr_id);
switch (attr_id) {
case DM_ATTR_CLASS_PORT_INFO:
srpt_get_class_port_info(rsp_mad);
break;
case DM_ATTR_IOU_INFO:
... | DoS | 0 | static void srpt_mgmt_method_get(struct srpt_port *sp, struct ib_mad *rq_mad,
struct ib_dm_mad *rsp_mad)
{
u16 attr_id;
u32 slot;
u8 hi, lo;
attr_id = be16_to_cpu(rq_mad->mad_hdr.attr_id);
switch (attr_id) {
case DM_ATTR_CLASS_PORT_INFO:
srpt_get_class_port_info(rsp_mad);
break;
case DM_ATTR_IOU_INFO:
... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,621 | static int srpt_parse_i_port_id(u8 i_port_id[16], const char *name)
{
const char *p;
unsigned len, count, leading_zero_bytes;
int ret, rc;
p = name;
if (strncasecmp(p, "0x", 2) == 0)
p += 2;
ret = -EINVAL;
len = strlen(p);
if (len % 2)
goto out;
count = min(len / 2, 16U);
leading_zero_bytes = 16 - count;... | DoS | 0 | static int srpt_parse_i_port_id(u8 i_port_id[16], const char *name)
{
const char *p;
unsigned len, count, leading_zero_bytes;
int ret, rc;
p = name;
if (strncasecmp(p, "0x", 2) == 0)
p += 2;
ret = -EINVAL;
len = strlen(p);
if (len % 2)
goto out;
count = min(len / 2, 16U);
leading_zero_bytes = 16 - count;... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,622 | static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx)
{
struct ib_send_wr *bad_wr;
int sq_wr_avail, ret, i;
enum dma_data_direction dir;
const int n_rdma = ioctx->n_rdma;
dir = ioctx->cmd.data_direction;
if (dir == DMA_TO_DEVICE) {
/* write */
ret = -ENOMEM;
sq_wr_a... | DoS | 0 | static int srpt_perform_rdmas(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx)
{
struct ib_send_wr *bad_wr;
int sq_wr_avail, ret, i;
enum dma_data_direction dir;
const int n_rdma = ioctx->n_rdma;
dir = ioctx->cmd.data_direction;
if (dir == DMA_TO_DEVICE) {
/* write */
ret = -ENOMEM;
sq_wr_a... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,623 | static int srpt_post_recv(struct srpt_device *sdev,
struct srpt_recv_ioctx *ioctx)
{
struct ib_sge list;
struct ib_recv_wr wr, *bad_wr;
BUG_ON(!sdev);
list.addr = ioctx->ioctx.dma;
list.length = srp_max_req_size;
list.lkey = sdev->pd->local_dma_lkey;
ioctx->ioctx.cqe.done = srpt_recv_done;
wr.wr_cqe = &i... | DoS | 0 | static int srpt_post_recv(struct srpt_device *sdev,
struct srpt_recv_ioctx *ioctx)
{
struct ib_sge list;
struct ib_recv_wr wr, *bad_wr;
BUG_ON(!sdev);
list.addr = ioctx->ioctx.dma;
list.length = srp_max_req_size;
list.lkey = sdev->pd->local_dma_lkey;
ioctx->ioctx.cqe.done = srpt_recv_done;
wr.wr_cqe = &i... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,624 | static int srpt_post_send(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx, int len)
{
struct ib_sge list;
struct ib_send_wr wr, *bad_wr;
struct srpt_device *sdev = ch->sport->sdev;
int ret;
atomic_inc(&ch->req_lim);
ret = -ENOMEM;
if (unlikely(atomic_dec_return(&ch->sq_wr_avail) < 0)) {
pr_warn("... | DoS | 0 | static int srpt_post_send(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx, int len)
{
struct ib_sge list;
struct ib_send_wr wr, *bad_wr;
struct srpt_device *sdev = ch->sport->sdev;
int ret;
atomic_inc(&ch->req_lim);
ret = -ENOMEM;
if (unlikely(atomic_dec_return(&ch->sq_wr_avail) < 0)) {
pr_warn("... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,625 | static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
{
pr_debug("QP event %d on cm_id=%p sess_name=%s state=%d\n",
event->event, ch->cm_id, ch->sess_name, srpt_get_ch_state(ch));
switch (event->event) {
case IB_EVENT_COMM_EST:
ib_cm_notify(ch->cm_id, event->event);
break;
case IB_EVENT... | DoS | 0 | static void srpt_qp_event(struct ib_event *event, struct srpt_rdma_ch *ch)
{
pr_debug("QP event %d on cm_id=%p sess_name=%s state=%d\n",
event->event, ch->cm_id, ch->sess_name, srpt_get_ch_state(ch));
switch (event->event) {
case IB_EVENT_COMM_EST:
ib_cm_notify(ch->cm_id, event->event);
break;
case IB_EVENT... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,626 | static int srpt_queue_data_in(struct se_cmd *cmd)
{
srpt_queue_response(cmd);
return 0;
}
| DoS | 0 | static int srpt_queue_data_in(struct se_cmd *cmd)
{
srpt_queue_response(cmd);
return 0;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,627 | static void srpt_queue_response(struct se_cmd *cmd)
{
struct srpt_rdma_ch *ch;
struct srpt_send_ioctx *ioctx;
enum srpt_command_state state;
unsigned long flags;
int ret;
enum dma_data_direction dir;
int resp_len;
u8 srp_tm_status;
ioctx = container_of(cmd, struct srpt_send_ioctx, cmd);
ch = ioctx->ch;
BUG_... | DoS | 0 | static void srpt_queue_response(struct se_cmd *cmd)
{
struct srpt_rdma_ch *ch;
struct srpt_send_ioctx *ioctx;
enum srpt_command_state state;
unsigned long flags;
int ret;
enum dma_data_direction dir;
int resp_len;
u8 srp_tm_status;
ioctx = container_of(cmd, struct srpt_send_ioctx, cmd);
ch = ioctx->ch;
BUG_... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,628 | static void srpt_rdma_read_done(struct ib_cq *cq, struct ib_wc *wc)
{
struct srpt_rdma_ch *ch = cq->cq_context;
struct srpt_send_ioctx *ioctx =
container_of(wc->wr_cqe, struct srpt_send_ioctx, rdma_cqe);
WARN_ON(ioctx->n_rdma <= 0);
atomic_add(ioctx->n_rdma, &ch->sq_wr_avail);
if (unlikely(wc->status != IB_WC_... | DoS | 0 | static void srpt_rdma_read_done(struct ib_cq *cq, struct ib_wc *wc)
{
struct srpt_rdma_ch *ch = cq->cq_context;
struct srpt_send_ioctx *ioctx =
container_of(wc->wr_cqe, struct srpt_send_ioctx, rdma_cqe);
WARN_ON(ioctx->n_rdma <= 0);
atomic_add(ioctx->n_rdma, &ch->sq_wr_avail);
if (unlikely(wc->status != IB_WC_... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,629 | static void srpt_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc)
{
struct srpt_send_ioctx *ioctx =
container_of(wc->wr_cqe, struct srpt_send_ioctx, rdma_cqe);
if (unlikely(wc->status != IB_WC_SUCCESS)) {
pr_info("RDMA_WRITE for ioctx 0x%p failed with status %d\n",
ioctx, wc->status);
srpt_abort_cmd(ioct... | DoS | 0 | static void srpt_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc)
{
struct srpt_send_ioctx *ioctx =
container_of(wc->wr_cqe, struct srpt_send_ioctx, rdma_cqe);
if (unlikely(wc->status != IB_WC_SUCCESS)) {
pr_info("RDMA_WRITE for ioctx 0x%p failed with status %d\n",
ioctx, wc->status);
srpt_abort_cmd(ioct... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,630 | static void srpt_recv_done(struct ib_cq *cq, struct ib_wc *wc)
{
struct srpt_rdma_ch *ch = cq->cq_context;
struct srpt_recv_ioctx *ioctx =
container_of(wc->wr_cqe, struct srpt_recv_ioctx, ioctx.cqe);
if (wc->status == IB_WC_SUCCESS) {
int req_lim;
req_lim = atomic_dec_return(&ch->req_lim);
if (unlikely(req... | DoS | 0 | static void srpt_recv_done(struct ib_cq *cq, struct ib_wc *wc)
{
struct srpt_rdma_ch *ch = cq->cq_context;
struct srpt_recv_ioctx *ioctx =
container_of(wc->wr_cqe, struct srpt_recv_ioctx, ioctx.cqe);
if (wc->status == IB_WC_SUCCESS) {
int req_lim;
req_lim = atomic_dec_return(&ch->req_lim);
if (unlikely(req... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,631 | static int srpt_refresh_port(struct srpt_port *sport)
{
struct ib_mad_reg_req reg_req;
struct ib_port_modify port_modify;
struct ib_port_attr port_attr;
int ret;
memset(&port_modify, 0, sizeof port_modify);
port_modify.set_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP;
port_modify.clr_port_cap_mask = 0;
ret = ib_mo... | DoS | 0 | static int srpt_refresh_port(struct srpt_port *sport)
{
struct ib_mad_reg_req reg_req;
struct ib_port_modify port_modify;
struct ib_port_attr port_attr;
int ret;
memset(&port_modify, 0, sizeof port_modify);
port_modify.set_port_cap_mask = IB_PORT_DEVICE_MGMT_SUP;
port_modify.clr_port_cap_mask = 0;
ret = ib_mo... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,632 | static void srpt_refresh_port_work(struct work_struct *work)
{
struct srpt_port *sport = container_of(work, struct srpt_port, work);
srpt_refresh_port(sport);
}
| DoS | 0 | static void srpt_refresh_port_work(struct work_struct *work)
{
struct srpt_port *sport = container_of(work, struct srpt_port, work);
srpt_refresh_port(sport);
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,633 | static void srpt_release_channel(struct srpt_rdma_ch *ch)
{
schedule_work(&ch->release_work);
}
| DoS | 0 | static void srpt_release_channel(struct srpt_rdma_ch *ch)
{
schedule_work(&ch->release_work);
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,634 | static void srpt_release_channel_work(struct work_struct *w)
{
struct srpt_rdma_ch *ch;
struct srpt_device *sdev;
struct se_session *se_sess;
ch = container_of(w, struct srpt_rdma_ch, release_work);
pr_debug("ch = %p; ch->sess = %p; release_done = %p\n", ch, ch->sess,
ch->release_done);
sdev = ch->sport->sde... | DoS | 0 | static void srpt_release_channel_work(struct work_struct *w)
{
struct srpt_rdma_ch *ch;
struct srpt_device *sdev;
struct se_session *se_sess;
ch = container_of(w, struct srpt_rdma_ch, release_work);
pr_debug("ch = %p; ch->sess = %p; release_done = %p\n", ch, ch->sess,
ch->release_done);
sdev = ch->sport->sde... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,635 | static void srpt_release_cmd(struct se_cmd *se_cmd)
{
struct srpt_send_ioctx *ioctx = container_of(se_cmd,
struct srpt_send_ioctx, cmd);
struct srpt_rdma_ch *ch = ioctx->ch;
unsigned long flags;
WARN_ON(ioctx->state != SRPT_STATE_DONE);
WARN_ON(ioctx->mapped_sg_count != 0);
if (ioctx->n_rbuf > 1) {
kfree(... | DoS | 0 | static void srpt_release_cmd(struct se_cmd *se_cmd)
{
struct srpt_send_ioctx *ioctx = container_of(se_cmd,
struct srpt_send_ioctx, cmd);
struct srpt_rdma_ch *ch = ioctx->ch;
unsigned long flags;
WARN_ON(ioctx->state != SRPT_STATE_DONE);
WARN_ON(ioctx->mapped_sg_count != 0);
if (ioctx->n_rbuf > 1) {
kfree(... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,636 | static int srpt_release_sdev(struct srpt_device *sdev)
{
struct srpt_rdma_ch *ch, *tmp_ch;
int res;
WARN_ON_ONCE(irqs_disabled());
BUG_ON(!sdev);
spin_lock_irq(&sdev->spinlock);
list_for_each_entry_safe(ch, tmp_ch, &sdev->rch_list, list)
__srpt_close_ch(ch);
spin_unlock_irq(&sdev->spinlock);
res = wait_ev... | DoS | 0 | static int srpt_release_sdev(struct srpt_device *sdev)
{
struct srpt_rdma_ch *ch, *tmp_ch;
int res;
WARN_ON_ONCE(irqs_disabled());
BUG_ON(!sdev);
spin_lock_irq(&sdev->spinlock);
list_for_each_entry_safe(ch, tmp_ch, &sdev->rch_list, list)
__srpt_close_ch(ch);
spin_unlock_irq(&sdev->spinlock);
res = wait_ev... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,637 | static void srpt_remove_one(struct ib_device *device, void *client_data)
{
struct srpt_device *sdev = client_data;
int i;
if (!sdev) {
pr_info("%s(%s): nothing to do.\n", __func__, device->name);
return;
}
srpt_unregister_mad_agent(sdev);
ib_unregister_event_handler(&sdev->event_handler);
/* Cancel any w... | DoS | 0 | static void srpt_remove_one(struct ib_device *device, void *client_data)
{
struct srpt_device *sdev = client_data;
int i;
if (!sdev) {
pr_info("%s(%s): nothing to do.\n", __func__, device->name);
return;
}
srpt_unregister_mad_agent(sdev);
ib_unregister_event_handler(&sdev->event_handler);
/* Cancel any w... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,638 | static void srpt_send_done(struct ib_cq *cq, struct ib_wc *wc)
{
struct srpt_rdma_ch *ch = cq->cq_context;
struct srpt_send_ioctx *ioctx =
container_of(wc->wr_cqe, struct srpt_send_ioctx, ioctx.cqe);
enum srpt_command_state state;
state = srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
WARN_ON(state != SRPT_STATE_... | DoS | 0 | static void srpt_send_done(struct ib_cq *cq, struct ib_wc *wc)
{
struct srpt_rdma_ch *ch = cq->cq_context;
struct srpt_send_ioctx *ioctx =
container_of(wc->wr_cqe, struct srpt_send_ioctx, ioctx.cqe);
enum srpt_command_state state;
state = srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
WARN_ON(state != SRPT_STATE_... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,639 | static u32 srpt_sess_get_index(struct se_session *se_sess)
{
return 0;
}
| DoS | 0 | static u32 srpt_sess_get_index(struct se_session *se_sess)
{
return 0;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,640 | static void srpt_set_ioc(u8 *c_list, u32 slot, u8 value)
{
u16 id;
u8 tmp;
id = (slot - 1) / 2;
if (slot & 0x1) {
tmp = c_list[id] & 0xf;
c_list[id] = (value << 4) | tmp;
} else {
tmp = c_list[id] & 0xf0;
c_list[id] = (value & 0xf) | tmp;
}
}
| DoS | 0 | static void srpt_set_ioc(u8 *c_list, u32 slot, u8 value)
{
u16 id;
u8 tmp;
id = (slot - 1) / 2;
if (slot & 0x1) {
tmp = c_list[id] & 0xf;
c_list[id] = (value << 4) | tmp;
} else {
tmp = c_list[id] & 0xf0;
c_list[id] = (value & 0xf) | tmp;
}
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,641 | static int srpt_shutdown_session(struct se_session *se_sess)
{
struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr;
unsigned long flags;
spin_lock_irqsave(&ch->spinlock, flags);
if (ch->in_shutdown) {
spin_unlock_irqrestore(&ch->spinlock, flags);
return true;
}
ch->in_shutdown = true;
target_sess_cmd_list_s... | DoS | 0 | static int srpt_shutdown_session(struct se_session *se_sess)
{
struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr;
unsigned long flags;
spin_lock_irqsave(&ch->spinlock, flags);
if (ch->in_shutdown) {
spin_unlock_irqrestore(&ch->spinlock, flags);
return true;
}
ch->in_shutdown = true;
target_sess_cmd_list_s... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,642 | srpt_test_and_set_ch_state(struct srpt_rdma_ch *ch, enum rdma_ch_state old,
enum rdma_ch_state new)
{
unsigned long flags;
enum rdma_ch_state prev;
spin_lock_irqsave(&ch->spinlock, flags);
prev = ch->state;
if (prev == old)
ch->state = new;
spin_unlock_irqrestore(&ch->spinlock, flags);
return prev == ol... | DoS | 0 | srpt_test_and_set_ch_state(struct srpt_rdma_ch *ch, enum rdma_ch_state old,
enum rdma_ch_state new)
{
unsigned long flags;
enum rdma_ch_state prev;
spin_lock_irqsave(&ch->spinlock, flags);
prev = ch->state;
if (prev == old)
ch->state = new;
spin_unlock_irqrestore(&ch->spinlock, flags);
return prev == ol... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,643 | static ssize_t srpt_tpg_attrib_srp_max_rdma_size_show(struct config_item *item,
char *page)
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size);
}
| DoS | 0 | static ssize_t srpt_tpg_attrib_srp_max_rdma_size_show(struct config_item *item,
char *page)
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_max_rdma_size);
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,644 | static ssize_t srpt_tpg_attrib_srp_max_rdma_size_store(struct config_item *item,
const char *page, size_t count)
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
unsigned long val;
int ret;
ret = kstrtoul(page, 0, &val);
if (r... | DoS | 0 | static ssize_t srpt_tpg_attrib_srp_max_rdma_size_store(struct config_item *item,
const char *page, size_t count)
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
unsigned long val;
int ret;
ret = kstrtoul(page, 0, &val);
if (r... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,645 | static ssize_t srpt_tpg_attrib_srp_max_rsp_size_show(struct config_item *item,
char *page)
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size);
}
| DoS | 0 | static ssize_t srpt_tpg_attrib_srp_max_rsp_size_show(struct config_item *item,
char *page)
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_max_rsp_size);
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,646 | static ssize_t srpt_tpg_attrib_srp_sq_size_show(struct config_item *item,
char *page)
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size);
}
| DoS | 0 | static ssize_t srpt_tpg_attrib_srp_sq_size_show(struct config_item *item,
char *page)
{
struct se_portal_group *se_tpg = attrib_to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return sprintf(page, "%u\n", sport->port_attrib.srp_sq_size);
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,647 | static ssize_t srpt_tpg_enable_show(struct config_item *item, char *page)
{
struct se_portal_group *se_tpg = to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0);
}
| DoS | 0 | static ssize_t srpt_tpg_enable_show(struct config_item *item, char *page)
{
struct se_portal_group *se_tpg = to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
return snprintf(page, PAGE_SIZE, "%d\n", (sport->enabled) ? 1: 0);
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,648 | static ssize_t srpt_tpg_enable_store(struct config_item *item,
const char *page, size_t count)
{
struct se_portal_group *se_tpg = to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
unsigned long tmp;
int ret;
ret = kstrtoul(page, 0, &tmp);
if (ret < 0) {
pr_err... | DoS | 0 | static ssize_t srpt_tpg_enable_store(struct config_item *item,
const char *page, size_t count)
{
struct se_portal_group *se_tpg = to_tpg(item);
struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1);
unsigned long tmp;
int ret;
ret = kstrtoul(page, 0, &tmp);
if (ret < 0) {
pr_err... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,649 | static u32 srpt_tpg_get_inst_index(struct se_portal_group *se_tpg)
{
return 1;
}
| DoS | 0 | static u32 srpt_tpg_get_inst_index(struct se_portal_group *se_tpg)
{
return 1;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,650 | static void srpt_unmap_sg_to_ib_sge(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx)
{
struct scatterlist *sg;
enum dma_data_direction dir;
BUG_ON(!ch);
BUG_ON(!ioctx);
BUG_ON(ioctx->n_rdma && !ioctx->rdma_wrs);
while (ioctx->n_rdma)
kfree(ioctx->rdma_wrs[--ioctx->n_rdma].wr.sg_list);
kfree(i... | DoS | 0 | static void srpt_unmap_sg_to_ib_sge(struct srpt_rdma_ch *ch,
struct srpt_send_ioctx *ioctx)
{
struct scatterlist *sg;
enum dma_data_direction dir;
BUG_ON(!ch);
BUG_ON(!ioctx);
BUG_ON(ioctx->n_rdma && !ioctx->rdma_wrs);
while (ioctx->n_rdma)
kfree(ioctx->rdma_wrs[--ioctx->n_rdma].wr.sg_list);
kfree(i... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,651 | static uint64_t srpt_unpack_lun(const uint8_t *lun, int len)
{
uint64_t res = NO_SUCH_LUN;
int addressing_method;
if (unlikely(len < 2)) {
pr_err("Illegal LUN length %d, expected 2 bytes or more\n",
len);
goto out;
}
switch (len) {
case 8:
if ((*((__be64 *)lun) &
cpu_to_be64(0x0000FFFFFFFF... | DoS | 0 | static uint64_t srpt_unpack_lun(const uint8_t *lun, int len)
{
uint64_t res = NO_SUCH_LUN;
int addressing_method;
if (unlikely(len < 2)) {
pr_err("Illegal LUN length %d, expected 2 bytes or more\n",
len);
goto out;
}
switch (len) {
case 8:
if ((*((__be64 *)lun) &
cpu_to_be64(0x0000FFFFFFFF... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,652 | static int srpt_write_pending(struct se_cmd *se_cmd)
{
struct srpt_rdma_ch *ch;
struct srpt_send_ioctx *ioctx;
enum srpt_command_state new_state;
enum rdma_ch_state ch_state;
int ret;
ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd);
new_state = srpt_set_cmd_state(ioctx, SRPT_STATE_NEED_DATA);
WARN_O... | DoS | 0 | static int srpt_write_pending(struct se_cmd *se_cmd)
{
struct srpt_rdma_ch *ch;
struct srpt_send_ioctx *ioctx;
enum srpt_command_state new_state;
enum rdma_ch_state ch_state;
int ret;
ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd);
new_state = srpt_set_cmd_state(ioctx, SRPT_STATE_NEED_DATA);
WARN_O... | @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,653 | static u8 tcm_to_srp_tsk_mgmt_status(const int tcm_mgmt_status)
{
switch (tcm_mgmt_status) {
case TMR_FUNCTION_COMPLETE:
return SRP_TSK_MGMT_SUCCESS;
case TMR_FUNCTION_REJECTED:
return SRP_TSK_MGMT_FUNC_NOT_SUPP;
}
return SRP_TSK_MGMT_FAILED;
}
| DoS | 0 | static u8 tcm_to_srp_tsk_mgmt_status(const int tcm_mgmt_status)
{
switch (tcm_mgmt_status) {
case TMR_FUNCTION_COMPLETE:
return SRP_TSK_MGMT_SUCCESS;
case TMR_FUNCTION_REJECTED:
return SRP_TSK_MGMT_FUNC_NOT_SUPP;
}
return SRP_TSK_MGMT_FAILED;
}
| @@ -1670,47 +1670,6 @@ static int srpt_handle_cmd(struct srpt_rdma_ch *ch,
return -1;
}
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management reques... | CWE-476 | null | null |
40,654 | static int add_to_buffer (char *buffer, int buffer_size, /* {{{ */
value_list_t *vl_def,
const data_set_t *ds, const value_list_t *vl)
{
char *buffer_orig = buffer;
if (strcmp (vl_def->host, vl->host) != 0)
{
if (write_part_string (&buffer, &buffer_size, TYPE_HOST,
vl->host, strlen (vl->host)) != 0)
r... | DoS Exec Code Overflow | 0 | static int add_to_buffer (char *buffer, int buffer_size, /* {{{ */
value_list_t *vl_def,
const data_set_t *ds, const value_list_t *vl)
{
char *buffer_orig = buffer;
if (strcmp (vl_def->host, vl->host) != 0)
{
if (write_part_string (&buffer, &buffer_size, TYPE_HOST,
vl->host, strlen (vl->host)) != 0)
r... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,655 | static _Bool check_notify_received (const notification_t *n) /* {{{ */
{
notification_meta_t *ptr;
for (ptr = n->meta; ptr != NULL; ptr = ptr->next)
if ((strcmp ("network:received", ptr->name) == 0)
&& (ptr->type == NM_TYPE_BOOLEAN))
return ((_Bool) ptr->nm_value.nm_boolean);
return (0);
} /* ... | DoS Exec Code Overflow | 0 | static _Bool check_notify_received (const notification_t *n) /* {{{ */
{
notification_meta_t *ptr;
for (ptr = n->meta; ptr != NULL; ptr = ptr->next)
if ((strcmp ("network:received", ptr->name) == 0)
&& (ptr->type == NM_TYPE_BOOLEAN))
return ((_Bool) ptr->nm_value.nm_boolean);
return (0);
} /* ... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,656 | static _Bool check_receive_okay (const value_list_t *vl) /* {{{ */
{
uint64_t time_sent = 0;
int status;
status = uc_meta_data_get_unsigned_int (vl,
"network:time_sent", &time_sent);
/* This is a value we already sent. Don't allow it to be received again in
* order to avoid looping. */
if ((status ... | DoS Exec Code Overflow | 0 | static _Bool check_receive_okay (const value_list_t *vl) /* {{{ */
{
uint64_t time_sent = 0;
int status;
status = uc_meta_data_get_unsigned_int (vl,
"network:time_sent", &time_sent);
/* This is a value we already sent. Don't allow it to be received again in
* order to avoid looping. */
if ((status ... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,657 | static _Bool check_send_notify_okay (const notification_t *n) /* {{{ */
{
static c_complain_t complain_forwarding = C_COMPLAIN_INIT_STATIC;
_Bool received = 0;
if (n->meta == NULL)
return (1);
received = check_notify_received (n);
if (network_config_forward && received)
{
c_complain_once (LOG_ERR... | DoS Exec Code Overflow | 0 | static _Bool check_send_notify_okay (const notification_t *n) /* {{{ */
{
static c_complain_t complain_forwarding = C_COMPLAIN_INIT_STATIC;
_Bool received = 0;
if (n->meta == NULL)
return (1);
received = check_notify_received (n);
if (network_config_forward && received)
{
c_complain_once (LOG_ERR... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,658 | static _Bool check_send_okay (const value_list_t *vl) /* {{{ */
{
_Bool received = 0;
int status;
if (network_config_forward != 0)
return (1);
if (vl->meta == NULL)
return (1);
status = meta_data_get_boolean (vl->meta, "network:received", &received);
if (status == -ENOENT)
return (1);
else ... | DoS Exec Code Overflow | 0 | static _Bool check_send_okay (const value_list_t *vl) /* {{{ */
{
_Bool received = 0;
int status;
if (network_config_forward != 0)
return (1);
if (vl->meta == NULL)
return (1);
status = meta_data_get_boolean (vl->meta, "network:received", &received);
if (status == -ENOENT)
return (1);
else ... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,659 | static void *dispatch_thread (void __attribute__((unused)) *arg) /* {{{ */
{
while (42)
{
receive_list_entry_t *ent;
sockent_t *se;
/* Lock and wait for more data to come in */
pthread_mutex_lock (&receive_list_lock);
while ((listen_loop == 0)
&& (receive_list_head == NULL))
pthre... | DoS Exec Code Overflow | 0 | static void *dispatch_thread (void __attribute__((unused)) *arg) /* {{{ */
{
while (42)
{
receive_list_entry_t *ent;
sockent_t *se;
/* Lock and wait for more data to come in */
pthread_mutex_lock (&receive_list_lock);
while ((listen_loop == 0)
&& (receive_list_head == NULL))
pthre... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,660 | static void flush_buffer (void)
{
DEBUG ("network plugin: flush_buffer: send_buffer_fill = %i",
send_buffer_fill);
network_send_buffer (send_buffer, (size_t) send_buffer_fill);
stats_octets_tx += ((uint64_t) send_buffer_fill);
stats_packets_tx++;
network_init_buffer ();
}
| DoS Exec Code Overflow | 0 | static void flush_buffer (void)
{
DEBUG ("network plugin: flush_buffer: send_buffer_fill = %i",
send_buffer_fill);
network_send_buffer (send_buffer, (size_t) send_buffer_fill);
stats_octets_tx += ((uint64_t) send_buffer_fill);
stats_packets_tx++;
network_init_buffer ();
}
| @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,661 | static void free_sockent_client (struct sockent_client *sec) /* {{{ */
{
if (sec->fd >= 0)
{
close (sec->fd);
sec->fd = -1;
}
sfree (sec->addr);
#if HAVE_LIBGCRYPT
sfree (sec->username);
sfree (sec->password);
if (sec->cypher != NULL)
gcry_cipher_close (sec->cypher);
#endif
} /* }}} void free_... | DoS Exec Code Overflow | 0 | static void free_sockent_client (struct sockent_client *sec) /* {{{ */
{
if (sec->fd >= 0)
{
close (sec->fd);
sec->fd = -1;
}
sfree (sec->addr);
#if HAVE_LIBGCRYPT
sfree (sec->username);
sfree (sec->password);
if (sec->cypher != NULL)
gcry_cipher_close (sec->cypher);
#endif
} /* }}} void free_... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,662 | void module_register (void)
{
plugin_register_complex_config ("network", network_config);
plugin_register_init ("network", network_init);
plugin_register_flush ("network", network_flush,
/* user_data = */ NULL);
} /* void module_register */
| DoS Exec Code Overflow | 0 | void module_register (void)
{
plugin_register_complex_config ("network", network_config);
plugin_register_init ("network", network_init);
plugin_register_flush ("network", network_flush,
/* user_data = */ NULL);
} /* void module_register */
| @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,663 | static int network_bind_socket (int fd, const struct addrinfo *ai, const int interface_idx)
{
#if KERNEL_SOLARIS
char loop = 0;
#else
int loop = 0;
#endif
int yes = 1;
/* allow multiple sockets to use the same PORT number */
if (setsockopt (fd, SOL_SOCKET, SO_REUSEADDR,
&yes, sizeof(yes)) == -1) {
... | DoS Exec Code Overflow | 0 | static int network_bind_socket (int fd, const struct addrinfo *ai, const int interface_idx)
{
#if KERNEL_SOLARIS
char loop = 0;
#else
int loop = 0;
#endif
int yes = 1;
/* allow multiple sockets to use the same PORT number */
if (setsockopt (fd, SOL_SOCKET, SO_REUSEADDR,
&yes, sizeof(yes)) == -1) {
... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,664 | static int network_config (oconfig_item_t *ci) /* {{{ */
{
int i;
/* The options need to be applied first */
for (i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("TimeToLive", child->key) == 0)
network_config_set_ttl (child);
}
for (i = 0; i < ci... | DoS Exec Code Overflow | 0 | static int network_config (oconfig_item_t *ci) /* {{{ */
{
int i;
/* The options need to be applied first */
for (i = 0; i < ci->children_num; i++)
{
oconfig_item_t *child = ci->children + i;
if (strcasecmp ("TimeToLive", child->key) == 0)
network_config_set_ttl (child);
}
for (i = 0; i < ci... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,665 | static int network_config_add_listen (const oconfig_item_t *ci) /* {{{ */
{
sockent_t *se;
int status;
int i;
if ((ci->values_num < 1) || (ci->values_num > 2)
|| (ci->values[0].type != OCONFIG_TYPE_STRING)
|| ((ci->values_num > 1) && (ci->values[1].type != OCONFIG_TYPE_STRING)))
{
ERROR ("net... | DoS Exec Code Overflow | 0 | static int network_config_add_listen (const oconfig_item_t *ci) /* {{{ */
{
sockent_t *se;
int status;
int i;
if ((ci->values_num < 1) || (ci->values_num > 2)
|| (ci->values[0].type != OCONFIG_TYPE_STRING)
|| ((ci->values_num > 1) && (ci->values[1].type != OCONFIG_TYPE_STRING)))
{
ERROR ("net... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,666 | static int network_config_add_server (const oconfig_item_t *ci) /* {{{ */
{
sockent_t *se;
int status;
int i;
if ((ci->values_num < 1) || (ci->values_num > 2)
|| (ci->values[0].type != OCONFIG_TYPE_STRING)
|| ((ci->values_num > 1) && (ci->values[1].type != OCONFIG_TYPE_STRING)))
{
ERROR ("net... | DoS Exec Code Overflow | 0 | static int network_config_add_server (const oconfig_item_t *ci) /* {{{ */
{
sockent_t *se;
int status;
int i;
if ((ci->values_num < 1) || (ci->values_num > 2)
|| (ci->values[0].type != OCONFIG_TYPE_STRING)
|| ((ci->values_num > 1) && (ci->values[1].type != OCONFIG_TYPE_STRING)))
{
ERROR ("net... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,667 | static int network_config_set_boolean (const oconfig_item_t *ci, /* {{{ */
int *retval)
{
if ((ci->values_num != 1)
|| ((ci->values[0].type != OCONFIG_TYPE_BOOLEAN)
&& (ci->values[0].type != OCONFIG_TYPE_STRING)))
{
ERROR ("network plugin: The `%s' config option needs "
"exactly one bo... | DoS Exec Code Overflow | 0 | static int network_config_set_boolean (const oconfig_item_t *ci, /* {{{ */
int *retval)
{
if ((ci->values_num != 1)
|| ((ci->values[0].type != OCONFIG_TYPE_BOOLEAN)
&& (ci->values[0].type != OCONFIG_TYPE_STRING)))
{
ERROR ("network plugin: The `%s' config option needs "
"exactly one bo... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,668 | static int network_config_set_buffer_size (const oconfig_item_t *ci) /* {{{ */
{
int tmp;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_NUMBER))
{
WARNING ("network plugin: The `MaxPacketSize' config option needs exactly "
"one numeric argument.");
return (-1);
}
tmp ... | DoS Exec Code Overflow | 0 | static int network_config_set_buffer_size (const oconfig_item_t *ci) /* {{{ */
{
int tmp;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_NUMBER))
{
WARNING ("network plugin: The `MaxPacketSize' config option needs exactly "
"one numeric argument.");
return (-1);
}
tmp ... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,669 | static int network_config_set_interface (const oconfig_item_t *ci, /* {{{ */
int *interface)
{
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("network plugin: The `Interface' config option needs exactly "
"one string argument.");
return (-1);
}
if... | DoS Exec Code Overflow | 0 | static int network_config_set_interface (const oconfig_item_t *ci, /* {{{ */
int *interface)
{
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("network plugin: The `Interface' config option needs exactly "
"one string argument.");
return (-1);
}
if... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,670 | static int network_config_set_security_level (oconfig_item_t *ci, /* {{{ */
int *retval)
{
char *str;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("network plugin: The `SecurityLevel' config option needs exactly "
"one string argument.");
return (-... | DoS Exec Code Overflow | 0 | static int network_config_set_security_level (oconfig_item_t *ci, /* {{{ */
int *retval)
{
char *str;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("network plugin: The `SecurityLevel' config option needs exactly "
"one string argument.");
return (-... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,671 | static int network_config_set_string (const oconfig_item_t *ci, /* {{{ */
char **ret_string)
{
char *tmp;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("network plugin: The `%s' config option needs exactly "
"one string argument.", ci->key);
return ... | DoS Exec Code Overflow | 0 | static int network_config_set_string (const oconfig_item_t *ci, /* {{{ */
char **ret_string)
{
char *tmp;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_STRING))
{
WARNING ("network plugin: The `%s' config option needs exactly "
"one string argument.", ci->key);
return ... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,672 | static int network_config_set_ttl (const oconfig_item_t *ci) /* {{{ */
{
int tmp;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_NUMBER))
{
WARNING ("network plugin: The `TimeToLive' config option needs exactly "
"one numeric argument.");
return (-1);
}
tmp = (int) ci-... | DoS Exec Code Overflow | 0 | static int network_config_set_ttl (const oconfig_item_t *ci) /* {{{ */
{
int tmp;
if ((ci->values_num != 1)
|| (ci->values[0].type != OCONFIG_TYPE_NUMBER))
{
WARNING ("network plugin: The `TimeToLive' config option needs exactly "
"one numeric argument.");
return (-1);
}
tmp = (int) ci-... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,673 | static int network_dispatch_notification (notification_t *n) /* {{{ */
{
int status;
assert (n->meta == NULL);
status = plugin_notification_meta_add_boolean (n, "network:received", 1);
if (status != 0)
{
ERROR ("network plugin: plugin_notification_meta_add_boolean failed.");
plugin_notification_meta... | DoS Exec Code Overflow | 0 | static int network_dispatch_notification (notification_t *n) /* {{{ */
{
int status;
assert (n->meta == NULL);
status = plugin_notification_meta_add_boolean (n, "network:received", 1);
if (status != 0)
{
ERROR ("network plugin: plugin_notification_meta_add_boolean failed.");
plugin_notification_meta... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,674 | static int network_dispatch_values (value_list_t *vl, /* {{{ */
const char *username)
{
int status;
if ((vl->time <= 0)
|| (strlen (vl->host) <= 0)
|| (strlen (vl->plugin) <= 0)
|| (strlen (vl->type) <= 0))
return (-EINVAL);
if (!check_receive_okay (vl))
{
#if COLLECT_DEBUG
char ... | DoS Exec Code Overflow | 0 | static int network_dispatch_values (value_list_t *vl, /* {{{ */
const char *username)
{
int status;
if ((vl->time <= 0)
|| (strlen (vl->host) <= 0)
|| (strlen (vl->plugin) <= 0)
|| (strlen (vl->type) <= 0))
return (-EINVAL);
if (!check_receive_okay (vl))
{
#if COLLECT_DEBUG
char ... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,675 | static int network_flush (__attribute__((unused)) cdtime_t timeout,
__attribute__((unused)) const char *identifier,
__attribute__((unused)) user_data_t *user_data)
{
pthread_mutex_lock (&send_buffer_lock);
if (send_buffer_fill > 0)
flush_buffer ();
pthread_mutex_unlock (&send_buffer_lock);
return (0);
} /... | DoS Exec Code Overflow | 0 | static int network_flush (__attribute__((unused)) cdtime_t timeout,
__attribute__((unused)) const char *identifier,
__attribute__((unused)) user_data_t *user_data)
{
pthread_mutex_lock (&send_buffer_lock);
if (send_buffer_fill > 0)
flush_buffer ();
pthread_mutex_unlock (&send_buffer_lock);
return (0);
} /... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,676 | static void network_init_buffer (void)
{
memset (send_buffer, 0, network_config_packet_size);
send_buffer_ptr = send_buffer;
send_buffer_fill = 0;
memset (&send_buffer_vl, 0, sizeof (send_buffer_vl));
} /* int network_init_buffer */
| DoS Exec Code Overflow | 0 | static void network_init_buffer (void)
{
memset (send_buffer, 0, network_config_packet_size);
send_buffer_ptr = send_buffer;
send_buffer_fill = 0;
memset (&send_buffer_vl, 0, sizeof (send_buffer_vl));
} /* int network_init_buffer */
| @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,677 | static void network_init_gcrypt (void) /* {{{ */
{
/* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
* Because you can't know in a library whether another library has
* already initialized the library */
if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
return;
/* http://www.gnupg.... | DoS Exec Code Overflow | 0 | static void network_init_gcrypt (void) /* {{{ */
{
/* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
* Because you can't know in a library whether another library has
* already initialized the library */
if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
return;
/* http://www.gnupg.... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,678 | static int network_notification (const notification_t *n,
user_data_t __attribute__((unused)) *user_data)
{
char buffer[network_config_packet_size];
char *buffer_ptr = buffer;
int buffer_free = sizeof (buffer);
int status;
if (!check_send_notify_okay (n))
return (0);
memset (buffer, 0, sizeof... | DoS Exec Code Overflow | 0 | static int network_notification (const notification_t *n,
user_data_t __attribute__((unused)) *user_data)
{
char buffer[network_config_packet_size];
char *buffer_ptr = buffer;
int buffer_free = sizeof (buffer);
int status;
if (!check_send_notify_okay (n))
return (0);
memset (buffer, 0, sizeof... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,679 | static int network_receive (void) /* {{{ */
{
char buffer[network_config_packet_size];
int buffer_len;
int i;
int status = 0;
receive_list_entry_t *private_list_head;
receive_list_entry_t *private_list_tail;
uint64_t private_list_length;
assert (listen_sockets_num > 0);
private_list_head = NU... | DoS Exec Code Overflow | 0 | static int network_receive (void) /* {{{ */
{
char buffer[network_config_packet_size];
int buffer_len;
int i;
int status = 0;
receive_list_entry_t *private_list_head;
receive_list_entry_t *private_list_tail;
uint64_t private_list_length;
assert (listen_sockets_num > 0);
private_list_head = NU... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,680 | static void network_send_buffer (char *buffer, size_t buffer_len) /* {{{ */
{
sockent_t *se;
DEBUG ("network plugin: network_send_buffer: buffer_len = %zu", buffer_len);
for (se = sending_sockets; se != NULL; se = se->next)
{
#if HAVE_LIBGCRYPT
if (se->data.client.security_level == SECURITY_LEVEL_ENCRYPT)... | DoS Exec Code Overflow | 0 | static void network_send_buffer (char *buffer, size_t buffer_len) /* {{{ */
{
sockent_t *se;
DEBUG ("network plugin: network_send_buffer: buffer_len = %zu", buffer_len);
for (se = sending_sockets; se != NULL; se = se->next)
{
#if HAVE_LIBGCRYPT
if (se->data.client.security_level == SECURITY_LEVEL_ENCRYPT)... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,681 | static int network_set_ttl (const sockent_t *se, const struct addrinfo *ai)
{
DEBUG ("network plugin: network_set_ttl: network_config_ttl = %i;",
network_config_ttl);
assert (se->type == SOCKENT_TYPE_CLIENT);
if ((network_config_ttl < 1) || (network_config_ttl > 255))
return (-1);
if (ai->ai_family =... | DoS Exec Code Overflow | 0 | static int network_set_ttl (const sockent_t *se, const struct addrinfo *ai)
{
DEBUG ("network plugin: network_set_ttl: network_config_ttl = %i;",
network_config_ttl);
assert (se->type == SOCKENT_TYPE_CLIENT);
if ((network_config_ttl < 1) || (network_config_ttl > 255))
return (-1);
if (ai->ai_family =... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,682 | static int network_shutdown (void)
{
sockent_t *se;
listen_loop++;
/* Kill the listening thread */
if (receive_thread_running != 0)
{
INFO ("network plugin: Stopping receive thread.");
pthread_kill (receive_thread_id, SIGTERM);
pthread_join (receive_thread_id, NULL /* no return value */);
memset (&receiv... | DoS Exec Code Overflow | 0 | static int network_shutdown (void)
{
sockent_t *se;
listen_loop++;
/* Kill the listening thread */
if (receive_thread_running != 0)
{
INFO ("network plugin: Stopping receive thread.");
pthread_kill (receive_thread_id, SIGTERM);
pthread_join (receive_thread_id, NULL /* no return value */);
memset (&receiv... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,683 | static int network_stats_read (void) /* {{{ */
{
derive_t copy_octets_rx;
derive_t copy_octets_tx;
derive_t copy_packets_rx;
derive_t copy_packets_tx;
derive_t copy_values_dispatched;
derive_t copy_values_not_dispatched;
derive_t copy_values_sent;
derive_t copy_values_not_sent;
derive_t copy_receive_list_lengt... | DoS Exec Code Overflow | 0 | static int network_stats_read (void) /* {{{ */
{
derive_t copy_octets_rx;
derive_t copy_octets_tx;
derive_t copy_packets_rx;
derive_t copy_packets_tx;
derive_t copy_values_dispatched;
derive_t copy_values_not_dispatched;
derive_t copy_values_sent;
derive_t copy_values_not_sent;
derive_t copy_receive_list_lengt... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,684 | static int network_write (const data_set_t *ds, const value_list_t *vl,
user_data_t __attribute__((unused)) *user_data)
{
int status;
if (!check_send_okay (vl))
{
#if COLLECT_DEBUG
char name[6*DATA_MAX_NAME_LEN];
FORMAT_VL (name, sizeof (name), vl);
name[sizeof (name) - 1] = 0;
DEBUG ("network plugin:... | DoS Exec Code Overflow | 0 | static int network_write (const data_set_t *ds, const value_list_t *vl,
user_data_t __attribute__((unused)) *user_data)
{
int status;
if (!check_send_okay (vl))
{
#if COLLECT_DEBUG
char name[6*DATA_MAX_NAME_LEN];
FORMAT_VL (name, sizeof (name), vl);
name[sizeof (name) - 1] = 0;
DEBUG ("network plugin:... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,685 | static void networt_send_buffer_plain (sockent_t *se, /* {{{ */
const char *buffer, size_t buffer_size)
{
int status;
while (42)
{
status = sockent_client_connect (se);
if (status != 0)
return;
status = sendto (se->data.client.fd, buffer, buffer_size,
/* flags = */ 0,
(struct sockaddr *) se->dat... | DoS Exec Code Overflow | 0 | static void networt_send_buffer_plain (sockent_t *se, /* {{{ */
const char *buffer, size_t buffer_size)
{
int status;
while (42)
{
status = sockent_client_connect (se);
if (status != 0)
return;
status = sendto (se->data.client.fd, buffer, buffer_size,
/* flags = */ 0,
(struct sockaddr *) se->dat... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,686 | static int parse_part_encr_aes256 (sockent_t *se, /* {{{ */
void **ret_buffer, size_t *ret_buffer_len,
int flags)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
size_t payload_len;
size_t part_size;
size_t buffer_offset;
uint16_t username_len;
part_encryption_aes256_t pea;
unsig... | DoS Exec Code Overflow | 0 | static int parse_part_encr_aes256 (sockent_t *se, /* {{{ */
void **ret_buffer, size_t *ret_buffer_len,
int flags)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
size_t payload_len;
size_t part_size;
size_t buffer_offset;
uint16_t username_len;
part_encryption_aes256_t pea;
unsig... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,687 | static int parse_part_encr_aes256 (sockent_t *se, /* {{{ */
void **ret_buffer, size_t *ret_buffer_size, int flags)
{
static int warning_has_been_printed = 0;
char *buffer;
size_t buffer_size;
size_t buffer_offset;
part_header_t ph;
size_t ph_length;
buffer = *ret_buffer;
buffer_size = *ret_buffer... | DoS Exec Code Overflow | 0 | static int parse_part_encr_aes256 (sockent_t *se, /* {{{ */
void **ret_buffer, size_t *ret_buffer_size, int flags)
{
static int warning_has_been_printed = 0;
char *buffer;
size_t buffer_size;
size_t buffer_offset;
part_header_t ph;
size_t ph_length;
buffer = *ret_buffer;
buffer_size = *ret_buffer... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,688 | static int parse_part_number (void **ret_buffer, size_t *ret_buffer_len,
uint64_t *value)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
uint16_t tmp16;
uint64_t tmp64;
size_t exp_size = 2 * sizeof (uint16_t) + sizeof (uint64_t);
uint16_t pkg_length;
if (buffer_len < exp_size)
{
WARNI... | DoS Exec Code Overflow | 0 | static int parse_part_number (void **ret_buffer, size_t *ret_buffer_len,
uint64_t *value)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
uint16_t tmp16;
uint64_t tmp64;
size_t exp_size = 2 * sizeof (uint16_t) + sizeof (uint64_t);
uint16_t pkg_length;
if (buffer_len < exp_size)
{
WARNI... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,689 | static int parse_part_sign_sha256 (sockent_t *se, /* {{{ */
void **ret_buffer, size_t *ret_buffer_size, int flags)
{
static int warning_has_been_printed = 0;
char *buffer;
size_t buffer_size;
size_t buffer_offset;
uint16_t part_len;
part_signature_sha256_t pss;
buffer = *ret_buffer;
buffer_size =... | DoS Exec Code Overflow | 0 | static int parse_part_sign_sha256 (sockent_t *se, /* {{{ */
void **ret_buffer, size_t *ret_buffer_size, int flags)
{
static int warning_has_been_printed = 0;
char *buffer;
size_t buffer_size;
size_t buffer_offset;
uint16_t part_len;
part_signature_sha256_t pss;
buffer = *ret_buffer;
buffer_size =... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,690 | static int parse_part_string (void **ret_buffer, size_t *ret_buffer_len,
char *output, int output_len)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
uint16_t tmp16;
size_t header_size = 2 * sizeof (uint16_t);
uint16_t pkg_length;
if (buffer_len < header_size)
{
WARNING ("network plugi... | DoS Exec Code Overflow | 0 | static int parse_part_string (void **ret_buffer, size_t *ret_buffer_len,
char *output, int output_len)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
uint16_t tmp16;
size_t header_size = 2 * sizeof (uint16_t);
uint16_t pkg_length;
if (buffer_len < header_size)
{
WARNING ("network plugi... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,691 | static int parse_part_values (void **ret_buffer, size_t *ret_buffer_len,
value_t **ret_values, int *ret_num_values)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
uint16_t tmp16;
size_t exp_size;
int i;
uint16_t pkg_length;
uint16_t pkg_type;
uint16_t pkg_numval;
uint8_t *pkg_types;
... | DoS Exec Code Overflow | 0 | static int parse_part_values (void **ret_buffer, size_t *ret_buffer_len,
value_t **ret_values, int *ret_num_values)
{
char *buffer = *ret_buffer;
size_t buffer_len = *ret_buffer_len;
uint16_t tmp16;
size_t exp_size;
int i;
uint16_t pkg_length;
uint16_t pkg_type;
uint16_t pkg_numval;
uint8_t *pkg_types;
... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,692 | static void *receive_thread (void __attribute__((unused)) *arg)
{
return (network_receive () ? (void *) 1 : (void *) 0);
} /* void *receive_thread */
| DoS Exec Code Overflow | 0 | static void *receive_thread (void __attribute__((unused)) *arg)
{
return (network_receive () ? (void *) 1 : (void *) 0);
} /* void *receive_thread */
| @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,693 | static int sockent_add (sockent_t *se) /* {{{ */
{
sockent_t *last_ptr;
if (se == NULL)
return (-1);
if (se->type == SOCKENT_TYPE_SERVER)
{
struct pollfd *tmp;
size_t i;
tmp = realloc (listen_sockets_pollfd,
sizeof (*tmp) * (listen_sockets_num
+ se->data.server.fd_num));
if (tmp == NULL)
{
... | DoS Exec Code Overflow | 0 | static int sockent_add (sockent_t *se) /* {{{ */
{
sockent_t *last_ptr;
if (se == NULL)
return (-1);
if (se->type == SOCKENT_TYPE_SERVER)
{
struct pollfd *tmp;
size_t i;
tmp = realloc (listen_sockets_pollfd,
sizeof (*tmp) * (listen_sockets_num
+ se->data.server.fd_num));
if (tmp == NULL)
{
... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,694 | static int sockent_client_connect (sockent_t *se) /* {{{ */
{
static c_complain_t complaint = C_COMPLAIN_INIT_STATIC;
struct sockent_client *client;
struct addrinfo ai_hints;
struct addrinfo *ai_list = NULL, *ai_ptr;
int status;
if ((se == NULL) || (se->type != SOCKENT_TYPE_CLIENT))
return (EINVAL);
client... | DoS Exec Code Overflow | 0 | static int sockent_client_connect (sockent_t *se) /* {{{ */
{
static c_complain_t complaint = C_COMPLAIN_INIT_STATIC;
struct sockent_client *client;
struct addrinfo ai_hints;
struct addrinfo *ai_list = NULL, *ai_ptr;
int status;
if ((se == NULL) || (se->type != SOCKENT_TYPE_CLIENT))
return (EINVAL);
client... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,695 | static sockent_t *sockent_create (int type) /* {{{ */
{
sockent_t *se;
if ((type != SOCKENT_TYPE_CLIENT) && (type != SOCKENT_TYPE_SERVER))
return (NULL);
se = malloc (sizeof (*se));
if (se == NULL)
return (NULL);
memset (se, 0, sizeof (*se));
se->type = type;
se->node = NULL;
se->service = NULL;
se->int... | DoS Exec Code Overflow | 0 | static sockent_t *sockent_create (int type) /* {{{ */
{
sockent_t *se;
if ((type != SOCKENT_TYPE_CLIENT) && (type != SOCKENT_TYPE_SERVER))
return (NULL);
se = malloc (sizeof (*se));
if (se == NULL)
return (NULL);
memset (se, 0, sizeof (*se));
se->type = type;
se->node = NULL;
se->service = NULL;
se->int... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,696 | static void sockent_destroy (sockent_t *se) /* {{{ */
{
sockent_t *next;
DEBUG ("network plugin: sockent_destroy (se = %p);", (void *) se);
while (se != NULL)
{
next = se->next;
sfree (se->node);
sfree (se->service);
if (se->type == SOCKENT_TYPE_CLIENT)
free_sockent_client (&se->data.c... | DoS Exec Code Overflow | 0 | static void sockent_destroy (sockent_t *se) /* {{{ */
{
sockent_t *next;
DEBUG ("network plugin: sockent_destroy (se = %p);", (void *) se);
while (se != NULL)
{
next = se->next;
sfree (se->node);
sfree (se->service);
if (se->type == SOCKENT_TYPE_CLIENT)
free_sockent_client (&se->data.c... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,697 | static int sockent_server_listen (sockent_t *se) /* {{{ */
{
struct addrinfo ai_hints;
struct addrinfo *ai_list, *ai_ptr;
int status;
const char *node;
const char *service;
if (se == NULL)
return (-1);
assert (se->data.server.fd == NULL);
assert (se->data.server.fd_num == 0);
... | DoS Exec Code Overflow | 0 | static int sockent_server_listen (sockent_t *se) /* {{{ */
{
struct addrinfo ai_hints;
struct addrinfo *ai_list, *ai_ptr;
int status;
const char *node;
const char *service;
if (se == NULL)
return (-1);
assert (se->data.server.fd == NULL);
assert (se->data.server.fd_num == 0);
... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,698 | static int write_part_number (char **ret_buffer, int *ret_buffer_len,
int type, uint64_t value)
{
char *packet_ptr;
int packet_len;
part_header_t pkg_head;
uint64_t pkg_value;
int offset;
packet_len = sizeof (pkg_head) + sizeof (pkg_value);
if (*ret_buffer_len < packet_len)
return (-1);
pkg_head.type =... | DoS Exec Code Overflow | 0 | static int write_part_number (char **ret_buffer, int *ret_buffer_len,
int type, uint64_t value)
{
char *packet_ptr;
int packet_len;
part_header_t pkg_head;
uint64_t pkg_value;
int offset;
packet_len = sizeof (pkg_head) + sizeof (pkg_value);
if (*ret_buffer_len < packet_len)
return (-1);
pkg_head.type =... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
40,699 | static int write_part_string (char **ret_buffer, int *ret_buffer_len,
int type, const char *str, int str_len)
{
char *buffer;
int buffer_len;
uint16_t pkg_type;
uint16_t pkg_length;
int offset;
buffer_len = 2 * sizeof (uint16_t) + str_len + 1;
if (*ret_buffer_len < buffer_len)
return (-1);
pkg_type = ht... | DoS Exec Code Overflow | 0 | static int write_part_string (char **ret_buffer, int *ret_buffer_len,
int type, const char *str, int str_len)
{
char *buffer;
int buffer_len;
uint16_t pkg_type;
uint16_t pkg_length;
int offset;
buffer_len = 2 * sizeof (uint16_t) + str_len + 1;
if (*ret_buffer_len < buffer_len)
return (-1);
pkg_type = ht... | @@ -1435,6 +1435,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
printed_ignore_warning = 1;
}
buffer = ((char *) buffer) + pkg_length;
+ buffer_size -= (size_t) pkg_length;
continue;
}
#endif /* HAVE_LIBGCRYPT */
@@ -1462,6 +1463,7 @@ static int parse_packet (sockent_t *se, /* {{{ */
... | CWE-119 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.