summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
2019748)
177117: fstat() returns -1 on error; the code is
checking for any positive value instead
175142: final return could never be reached; simple
refactoring
175235,175236: Warning suppressed with an explicit
cast to (void)
174817: Final return couldn't be reached; is
is_in_order is 0 then 'rv' is already returned
above
172095,172093: If is_is_set does not get set to 1,
then return 0 has already been invoked
174405: Re-kill this (nothing sets rv)
171136: Looks like a cmd line flag to set test_bytes
was missing; added it, and refactored the
argc/argv processing to avoid two other
potential segv's
176813: Add range checking for term width/height.
First stab at a reasonable range is 1-512
for both.
175350: Fix implicit casting in shift operation
174272: Not a c+p error; try using a coverity
annotation to ignore it
174273,175320: Annotated FORWARD_NULL
Change-Id: I58d0f860fc2209f59f8d1b6b344d631b8d429ace
Signed-off-by: Chris Luke <chrisy@flirble.org>
tsock = &scm->test_socket[i];
tsock->cfg.test = SOCK_TEST_TYPE_EXIT;
tsock = &scm->test_socket[i];
tsock->cfg.test = SOCK_TEST_TYPE_EXIT;
+ /* coverity[COPY_PASTE_ERROR] */
if (ctrl->cfg.verbose)
{
printf ("\nCLIENT (fd %d): Sending exit cfg to server...\n",
if (ctrl->cfg.verbose)
{
printf ("\nCLIENT (fd %d): Sending exit cfg to server...\n",
- bytes = ((long) atoi (argv[4])) << 20;
- no_echo = atoi (argv[3]);
portno = atoi (argv[2]);
server = gethostbyname (argv[1]);
if (server == NULL)
portno = atoi (argv[2]);
server = gethostbyname (argv[1]);
if (server == NULL)
clib_unix_warning ("gethostbyname");
exit (1);
}
clib_unix_warning ("gethostbyname");
exit (1);
}
+
+ argc -= 3;
+ argv += 3;
+
+ if (argc)
+ {
+ bytes = ((long) atoi (argv[0])) << 20;
+ argc--;
+ argv++;
+ }
+ if (argc)
+ {
+ no_echo = atoi (argv[0]);
+ argc--;
+ argv++;
+ }
+ if (argc)
+ {
+ test_bytes = atoi (argv[0]);
+ argc--;
+ argv++;
+ }
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
- unformat_user (input, unformat_line_input, line_input);
+ (void) unformat_user (input, unformat_line_input, line_input);
unformat_skip_white_space (line_input);
if (unformat (line_input, "vppcom {"))
unformat_skip_white_space (line_input);
if (unformat (line_input, "vppcom {"))
clib_bitmap_get (vcm->ex_bitmap, session_index) && (rv < 0))
{
// TBD: clib_warning
clib_bitmap_get (vcm->ex_bitmap, session_index) && (rv < 0))
{
// TBD: clib_warning
+ /* coverity[FORWARD_NULL] */
clib_bitmap_set_no_check (except_map, session_index, 1);
bits_set++;
}
else if (rv > 0)
{
// TBD: clib_warning
clib_bitmap_set_no_check (except_map, session_index, 1);
bits_set++;
}
else if (rv > 0)
{
// TBD: clib_warning
+ /* coverity[FORWARD_NULL] */
clib_bitmap_set_no_check (read_map, session_index, 1);
bits_set++;
}
clib_bitmap_set_no_check (read_map, session_index, 1);
bits_set++;
}
rv = vppcom_session_write_ready (session, session_index);
clib_spinlock_unlock (&vcm->sessions_lockp);
rv = vppcom_session_write_ready (session, session_index);
clib_spinlock_unlock (&vcm->sessions_lockp);
+ /* coverity[FORWARD_NULL] */
clib_bitmap_set_no_check (write_map, session_index, 1);
bits_set++;
}
clib_bitmap_set_no_check (write_map, session_index, 1);
bits_set++;
}
if (rv < 0)
{
// TBD: clib_warning
if (rv < 0)
{
// TBD: clib_warning
+ /* coverity[FORWARD_NULL] */
clib_bitmap_set_no_check (except_map, session_index, 1);
bits_set++;
}
clib_bitmap_set_no_check (except_map, session_index, 1);
bits_set++;
}
pr->mem = alloc.addr;
pr->log2_page_size = alloc.log2_page_size;
pr->n_pages = alloc.n_pages;
pr->mem = alloc.addr;
pr->log2_page_size = alloc.log2_page_size;
pr->n_pages = alloc.n_pages;
- pr->size = pr->n_pages << pr->log2_page_size;
+ pr->size = (u64) pr->n_pages << (u64) pr->log2_page_size;
pr->page_mask = (1 << pr->log2_page_size) - 1;
pr->numa_node = numa_node;
pr->name = format (0, "%s", name);
pr->page_mask = (1 << pr->log2_page_size) - 1;
pr->numa_node = numa_node;
pr->name = format (0, "%s", name);
* protocol message. This is a saftey measure. */
#define UNIX_CLI_MAX_DEPTH_TELNET 24
* protocol message. This is a saftey measure. */
#define UNIX_CLI_MAX_DEPTH_TELNET 24
+/** Minimum terminal width we will accept */
+#define UNIX_CLI_MIN_TERMINAL_WIDTH 1
+/** Maximum terminal width we will accept */
+#define UNIX_CLI_MAX_TERMINAL_WIDTH 512
+/** Minimum terminal height we will accept */
+#define UNIX_CLI_MIN_TERMINAL_HEIGHT 1
+/** Maximum terminal height we will accept */
+#define UNIX_CLI_MAX_TERMINAL_HEIGHT 512
+
/** Unix standard in */
#define UNIX_CLI_STDIN_FD 0
/** Unix standard in */
#define UNIX_CLI_STDIN_FD 0
/* Window size */
if (i != 8) /* check message is correct size */
break;
/* Window size */
if (i != 8) /* check message is correct size */
break;
cf->width =
clib_net_to_host_u16 (*((u16 *) (input_vector + 3)));
cf->width =
clib_net_to_host_u16 (*((u16 *) (input_vector + 3)));
+ if (cf->width > UNIX_CLI_MAX_TERMINAL_WIDTH)
+ cf->width = UNIX_CLI_MAX_TERMINAL_WIDTH;
+ if (cf->width < UNIX_CLI_MIN_TERMINAL_WIDTH)
+ cf->width = UNIX_CLI_MIN_TERMINAL_WIDTH;
+
cf->height =
clib_net_to_host_u16 (*((u16 *) (input_vector + 5)));
cf->height =
clib_net_to_host_u16 (*((u16 *) (input_vector + 5)));
+ if (cf->height > UNIX_CLI_MAX_TERMINAL_HEIGHT)
+ cf->height = UNIX_CLI_MAX_TERMINAL_HEIGHT;
+ if (cf->height < UNIX_CLI_MIN_TERMINAL_HEIGHT)
+ cf->height = UNIX_CLI_MIN_TERMINAL_HEIGHT;
+
/* reindex pager buffer */
unix_cli_pager_reindex (cf);
/* redraw page */
/* reindex pager buffer */
unix_cli_pager_reindex (cf);
/* redraw page */
/* We can't trust ws.XXX... */
return;
}
/* We can't trust ws.XXX... */
return;
}
+ if (cf->width > UNIX_CLI_MAX_TERMINAL_WIDTH)
+ cf->width = UNIX_CLI_MAX_TERMINAL_WIDTH;
+ if (cf->width < UNIX_CLI_MIN_TERMINAL_WIDTH)
+ cf->width = UNIX_CLI_MIN_TERMINAL_WIDTH;
+
+ if (cf->height > UNIX_CLI_MAX_TERMINAL_HEIGHT)
+ cf->height = UNIX_CLI_MAX_TERMINAL_HEIGHT;
+ if (cf->height < UNIX_CLI_MIN_TERMINAL_HEIGHT)
+ cf->height = UNIX_CLI_MIN_TERMINAL_HEIGHT;
/* Reindex the pager buffer */
unix_cli_pager_reindex (cf);
/* Reindex the pager buffer */
unix_cli_pager_reindex (cf);
else
mpls_table_delete (ntohl (mp->mt_table_id), 1);
else
mpls_table_delete (ntohl (mp->mt_table_id), 1);
- rv = (rv == 0) ? vnm->api_errno : rv;
+ // NB: Nothing sets rv; none of the above returns an error
REPLY_MACRO (VL_API_MPLS_TABLE_ADD_DEL_REPLY);
}
REPLY_MACRO (VL_API_MPLS_TABLE_ADD_DEL_REPLY);
}
- if (is_in_order)
- return enqueued;
-
- return 0;
}
/** Check if we have space in rx fifo to push more bytes */
}
/** Check if we have space in rx fifo to push more bytes */
*is_ip4 = 0;
tuple_is_set = 1;
}
*is_ip4 = 0;
tuple_is_set = 1;
}
- else
- return 0;
-
- if (tuple_is_set)
- return 1;
u8 proto = ~0;
ip46_address_t lcl, rmt;
u32 lcl_port = 0, rmt_port = 0;
u8 proto = ~0;
ip46_address_t lcl, rmt;
u32 lcl_port = 0, rmt_port = 0;
- u8 is_ip4 = 0, s_type = ~0, id_is_set = 0;
+ u8 is_ip4 = 0, s_type = ~0;
- if (unformat (input, "%U", unformat_stream_session_id, &proto, &lcl, &rmt,
- &lcl_port, &rmt_port, &is_ip4))
- {
- id_is_set = 1;
- }
- else
+ if (!unformat (input, "%U", unformat_stream_session_id, &proto, &lcl, &rmt,
+ &lcl_port, &rmt_port, &is_ip4))
- if (!id_is_set)
- {
- return 0;
- }
-
s_type = session_type_from_proto_and_ip (proto, is_ip4);
if (is_ip4)
s = stream_session_lookup4 (&lcl.ip4, &rmt.ip4,
s_type = session_type_from_proto_and_ip (proto, is_ip4);
if (is_ip4)
s = stream_session_lookup4 (&lcl.ip4, &rmt.ip4,
u8 proto = ~0;
ip46_address_t lcl, rmt;
u32 lcl_port = 0, rmt_port = 0;
u8 proto = ~0;
ip46_address_t lcl, rmt;
u32 lcl_port = 0, rmt_port = 0;
- u8 is_ip4 = 0, s_type = ~0, id_is_set = 0;
+ u8 is_ip4 = 0, s_type = ~0;
- if (unformat (input, "%U", unformat_stream_session_id, &proto, &lcl, &rmt,
- &lcl_port, &rmt_port, &is_ip4))
- {
- id_is_set = 1;
- }
- else
+ if (!unformat (input, "%U", unformat_stream_session_id, &proto, &lcl, &rmt,
+ &lcl_port, &rmt_port, &is_ip4))
- if (!id_is_set)
- {
- return 0;
- }
-
proto = (proto == (u8) ~ 0) ? suggested_proto : proto;
if (proto == (u8) ~ 0)
return 0;
proto = (proto == (u8) ~ 0) ? suggested_proto : proto;
if (proto == (u8) ~ 0)
return 0;
{
make_v4_ss_kv_from_tc (&kv4, tc);
kv4.value = value;
{
make_v4_ss_kv_from_tc (&kv4, tc);
kv4.value = value;
- clib_bihash_add_del_16_8 (&sl->v4_half_open_hash, &kv4,
- 1 /* is_add */ );
+ (void) clib_bihash_add_del_16_8 (&sl->v4_half_open_hash, &kv4,
+ 1 /* is_add */ );
}
else
{
make_v6_ss_kv_from_tc (&kv6, tc);
kv6.value = value;
}
else
{
make_v6_ss_kv_from_tc (&kv6, tc);
kv6.value = value;
- clib_bihash_add_del_48_8 (&sl->v6_half_open_hash, &kv6,
- 1 /* is_add */ );
+ (void) clib_bihash_add_del_48_8 (&sl->v6_half_open_hash, &kv6,
+ 1 /* is_add */ );
clib_mem_vm_get_log2_page_size (int fd)
{
struct stat st = { 0 };
clib_mem_vm_get_log2_page_size (int fd)
{
struct stat st = { 0 };
+ if (fstat (fd, &st) == -1)
return 0;
return min_log2 (st.st_blksize);
}
return 0;
return min_log2 (st.st_blksize);
}