Browse code

bb11432 - cleaning up additional warning messages.

Micah Snyder authored on 2017/08/22 06:03:42
Showing 9 changed files
... ...
@@ -462,15 +462,16 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
462 462
 
463 463
 #define DEFINE_OP_BC_RET_N(OP, T, R0, W0) \
464 464
     case OP: {\
465
+                operand_t ret;\
465 466
                 T tmp;\
466 467
                 R0(tmp, inst->u.unaryop);\
467 468
                 CHECK_GT(stack_depth, 0);\
468 469
                 stack_depth--;\
469
-                stack_entry = pop_stack(&stack, stack_entry, &func, &i, &bb,\
470
+                stack_entry = pop_stack(&stack, stack_entry, &func, &ret, &bb,\
470 471
                                         &bb_inst);\
471 472
                 values = stack_entry ? stack_entry->values : ctx->values;\
472
-                CHECK_GT(func->numBytes, i);\
473
-                W0(i, tmp);\
473
+                CHECK_GT(func->numBytes, ret);\
474
+                W0(ret, tmp);\
474 475
                 if (!bb) {\
475 476
                     stop = CL_BREAK;\
476 477
                     continue;\
... ...
@@ -706,7 +707,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
706 706
             DEFINE_BINOP(OP_BC_XOR, res = op0 ^ op1);
707 707
 
708 708
             DEFINE_SCASTOP(OP_BC_SEXT,
709
-                          CHOOSE(READ1(sres, inst->u.cast.source); res = sres ? ~0ull : 0,
709
+                          CHOOSE(READ1(sres, inst->u.cast.source); res = sres ? ~0 : 0,
710 710
                                  READ8(sres, inst->u.cast.source); res=sres=SIGNEXT(sres, inst->u.cast.mask),
711 711
                                  READ16(sres, inst->u.cast.source); res=sres=SIGNEXT(sres, inst->u.cast.mask),
712 712
                                  READ32(sres, inst->u.cast.source); res=sres=SIGNEXT(sres, inst->u.cast.mask),
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  *  HTML Entity & Encoding normalization.
3 3
  *
4
- *  Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
4
+ *  Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 5
  *  Copyright (C) 2007-2008 Sourcefire, Inc.
6 6
  *
7 7
  *  Authors: Török Edvin
... ...
@@ -49,7 +49,7 @@ struct entity_conv {
49 49
 	unsigned char entity_buff[MAX_ENTITY_SIZE+2];
50 50
 };
51 51
 
52
-enum encodings {E_UCS4,E_UTF16,E_UCS4_1234,E_UCS4_4321,E_UCS4_2143,E_UCS4_3412,E_UTF16_BE,E_UTF16_LE,E_UTF8, E_UNKNOWN,E_OTHER, E_ICONV};
52
+enum encodings {E_UCS4,E_UTF16,E_UCS4_1234,E_UCS4_4321,E_UCS4_2143,E_UCS4_3412,E_UTF16_BE,E_UTF16_LE,E_UTF8, E_UNKNOWN,E_OTHER};
53 53
 
54 54
 unsigned char* u16_normalize_tobuffer(uint16_t u16, unsigned char* dst, size_t dst_size);
55 55
 const char* entity_norm(struct entity_conv* conv,const unsigned char* entity);
... ...
@@ -187,6 +187,9 @@ void cli_event_int(cli_events_t *ctx, unsigned id, uint64_t arg)
187 187
         ev_chain(ctx, ev, &val);
188 188
         break;
189 189
     }
190
+    default:
191
+        // TODO: Consider if we should handle multiple_concat cases.
192
+        break;
190 193
     }
191 194
 }
192 195
 
... ...
@@ -273,6 +276,9 @@ static void event_string(cli_events_t *ctx, struct cli_event *ev, const char *st
273 273
         ev_chain(ctx, ev, &val);
274 274
         break;
275 275
     }
276
+    default:
277
+        // TODO: Consider if we should handle multiple_sum, multiple_concat cases.
278
+        break;
276 279
     }
277 280
 }
278 281
 
... ...
@@ -339,6 +345,9 @@ void cli_event_data(cli_events_t *ctx, unsigned id, const void *data, uint32_t l
339 339
         }
340 340
         break;
341 341
     }
342
+    default:
343
+        // TODO: Consider if we should handle multiple_sum, multiple_chain cases.
344
+        break;
342 345
     }
343 346
 }
344 347
 
... ...
@@ -397,6 +406,9 @@ static inline void ev_debug(enum ev_type type, union ev_val *val, uint32_t count
397 397
         cli_dbgmsg("\t(%u): %d.%06us\n", count, (signed)(val->v_int / 1000000),
398 398
                    (unsigned)(val->v_int % 1000000));
399 399
         break;
400
+    default:
401
+        // TODO: Consider if we should handle ev_none cases.
402
+        break;
400 403
     }
401 404
 }
402 405
 
... ...
@@ -463,6 +475,9 @@ static int ev_diff(enum ev_type type, union ev_val *v1, union ev_val *v2, uint32
463 463
         return memcmp(v1->v_data, v2->v_data, count);
464 464
     case ev_time:
465 465
         return 0;
466
+    default:
467
+        // TODO: Consider if we should handle ev_none cases.
468
+        break;
466 469
     }
467 470
     return 0;
468 471
 }
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
2
+ *  Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3 3
  *  Copyright (C) 2014 Sourcefire, Inc.
4 4
  *
5 5
  *  Authors: Kevin Lin <klin@sourcefire.com>
... ...
@@ -288,7 +288,7 @@ static int gpt_scan_partitions(cli_ctx *ctx, struct gpt_header hdr, size_t secto
288 288
 
289 289
     /* print header info for the debug */
290 290
     cli_dbgmsg("GPT Header:\n");
291
-    cli_dbgmsg("Signature: 0x%llx\n", hdr.signature);
291
+    cli_dbgmsg("Signature: 0x%llx\n", (long long unsigned)hdr.signature);
292 292
     cli_dbgmsg("Revision: %x\n", hdr.revision);
293 293
     gpt_printGUID(hdr.DiskGUID, "DISK GUID");
294 294
     cli_dbgmsg("Partition Entry Count: %u\n", hdr.tableNumEntries);
... ...
@@ -341,10 +341,10 @@ static int gpt_scan_partitions(cli_ctx *ctx, struct gpt_header hdr, size_t secto
341 341
             gpt_printName(gpe.name, "Name");
342 342
             gpt_printGUID(gpe.typeGUID, "Type GUID");
343 343
             gpt_printGUID(gpe.uniqueGUID, "Unique GUID");
344
-            cli_dbgmsg("Attributes: %llx\n", gpe.attributes);
344
+            cli_dbgmsg("Attributes: %llx\n", (long long unsigned)gpe.attributes);
345 345
             cli_dbgmsg("Blocks: [%llu(%llu) -> %llu(%llu)]\n",
346
-                       gpe.firstLBA, (gpe.firstLBA * sectorsize), 
347
-                       gpe.lastLBA, ((gpe.lastLBA+1) * sectorsize));
346
+                (long long unsigned)gpe.firstLBA, (long long unsigned)(gpe.firstLBA * sectorsize), 
347
+                (long long unsigned)gpe.lastLBA, (long long unsigned)((gpe.lastLBA+1) * sectorsize));
348 348
 
349 349
             /* send the partition to cli_map_scan */
350 350
             part_off = gpe.firstLBA * sectorsize;
... ...
@@ -414,7 +414,7 @@ static int gpt_validate_header(cli_ctx *ctx, struct gpt_header hdr, size_t secto
414 414
     /* check signature */
415 415
     if (hdr.signature != GPT_SIGNATURE) {
416 416
         cli_dbgmsg("cli_scangpt: Invalid GPT header signature %llx\n",
417
-                   hdr.signature);
417
+            (long long unsigned)hdr.signature);
418 418
         return CL_EFORMAT;
419 419
     }
420 420
 
... ...
@@ -3563,7 +3563,7 @@ print_trace(int use_syslog)
3563 3563
 	for(i = 0; i < size; i++) {
3564 3564
 		cli_errmsg("%s\n", strings[i]);
3565 3565
 		if(use_syslog)
3566
-			syslog(LOG_ERR, "bt[%u]: %s", i, strings[i]);
3566
+			syslog(LOG_ERR, "bt[%llu]: %s", (unsigned long long)i, strings[i]);
3567 3567
 	}
3568 3568
 
3569 3569
 #ifdef	SAVE_TMP
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Extract component parts of OLE2 files (e.g. MS Office Documents)
3 3
  * 
4
- * Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
4
+ * Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 5
  * Copyright (C) 2007-2013 Sourcefire, Inc.
6 6
  * 
7 7
  * Authors: Kevin Lin
... ...
@@ -913,7 +913,7 @@ int cli_ole2_summary_json(cli_ctx *ctx, int fd, int mode)
913 913
         return CL_EMAP;
914 914
     }
915 915
     sctx.maplen = sctx.sfmap->len;
916
-    cli_dbgmsg("ole2_summary_json: streamsize: %u\n", sctx.maplen);
916
+    cli_dbgmsg("ole2_summary_json: streamsize: %zu\n", sctx.maplen);
917 917
 
918 918
     switch (mode) {
919 919
     case 1:
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
2
+ *  Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3 3
  *  Copyright (C) 2013 Sourcefire, Inc.
4 4
  *
5 5
  *  Authors: Steven Morgan <smorgan@sourcefire.com>
... ...
@@ -127,8 +127,8 @@ static void xar_get_checksum_values(xmlTextReaderPtr reader, unsigned char ** ck
127 127
         xmlval = xmlTextReaderConstValue(reader);
128 128
         if (xmlval) {
129 129
             cli_dbgmsg("cli_scanxar: checksum value is %s.\n", xmlval);
130
-            if (*hash == XAR_CKSUM_SHA1 && xmlStrlen(xmlval) == 2 * CLI_HASHLEN_SHA1 ||
131
-                *hash == XAR_CKSUM_MD5 && xmlStrlen(xmlval) == 2 * CLI_HASHLEN_MD5)
130
+            if (( (*hash == XAR_CKSUM_SHA1)  &&  (xmlStrlen(xmlval) == 2 * CLI_HASHLEN_SHA1))  ||
131
+                ( (*hash == XAR_CKSUM_MD5)  &&  (xmlStrlen(xmlval) == 2 * CLI_HASHLEN_MD5) ))
132 132
                 {
133 133
                     *cksum = xmlStrdup(xmlval); 
134 134
                 } 
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * YARA parser for ClamAV: back-end functions
3 3
  * 
4
- * Copyright (C) 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
4
+ * Copyright (C) 2014, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 5
  * 
6 6
  * Authors: Steven Morgan
7 7
  * 
... ...
@@ -703,7 +703,7 @@ int yr_parser_reduce_rule_declaration(
703 703
 
704 704
   YR_RULE* rule;
705 705
   YR_STRING* string;
706
-  int8_t halt = OP_HALT;
706
+  uint8_t halt = OP_HALT;
707 707
 
708 708
   if (yr_hash_table_lookup(
709 709
         compiler->rules_table,
... ...
@@ -151,6 +151,7 @@ struct qm_trace {
151 151
 /*
152 152
  * Singly-linked List declarations.
153 153
  */
154
+#undef SLIST_HEAD
154 155
 #define	SLIST_HEAD(name, type)						\
155 156
 struct name {								\
156 157
 	struct type *slh_first;	/* first element */			\
... ...
@@ -159,6 +160,7 @@ struct name {								\
159 159
 #define	SLIST_HEAD_INITIALIZER(head)					\
160 160
 	{ NULL }
161 161
 
162
+#undef SLIST_ENTRY
162 163
 #define	SLIST_ENTRY(type)						\
163 164
 struct {								\
164 165
 	struct type *sle_next;	/* next element */			\
... ...
@@ -212,6 +214,7 @@ struct {								\
212 212
 
213 213
 #define	SLIST_NEXT(elm, field)	((elm)->field.sle_next)
214 214
 
215
+#undef SLIST_REMOVE
215 216
 #define	SLIST_REMOVE(head, elm, type, field) do {			\
216 217
 	QMD_SAVELINK(oldnext, (elm)->field.sle_next);			\
217 218
 	if (SLIST_FIRST((head)) == (elm)) {				\
... ...
@@ -246,6 +249,7 @@ struct {								\
246 246
 /*
247 247
  * Singly-linked Tail queue declarations.
248 248
  */
249
+#undef STAILQ_HEAD
249 250
 #define	STAILQ_HEAD(name, type)						\
250 251
 struct name {								\
251 252
 	struct type *stqh_first;/* first element */			\
... ...
@@ -255,6 +259,7 @@ struct name {								\
255 255
 #define	STAILQ_HEAD_INITIALIZER(head)					\
256 256
 	{ NULL, &(head).stqh_first }
257 257
 
258
+#undef STAILQ_ENTRY
258 259
 #define	STAILQ_ENTRY(type)						\
259 260
 struct {								\
260 261
 	struct type *stqe_next;	/* next element */			\
... ...
@@ -318,12 +323,14 @@ struct {								\
318 318
 	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\
319 319
 } while (0)
320 320
 
321
+#undef STAILQ_LAST
321 322
 #define	STAILQ_LAST(head, type, field)					\
322 323
 	(STAILQ_EMPTY((head)) ? NULL :					\
323 324
 	    __containerof((head)->stqh_last, struct type, field.stqe_next))
324 325
 
325 326
 #define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
326 327
 
328
+#undef STAILQ_REMOVE
327 329
 #define	STAILQ_REMOVE(head, elm, type, field) do {			\
328 330
 	QMD_SAVELINK(oldnext, (elm)->field.stqe_next);			\
329 331
 	if (STAILQ_FIRST((head)) == (elm)) {				\
... ...
@@ -350,6 +357,7 @@ struct {								\
350 350
 		(head)->stqh_last = &STAILQ_FIRST((head));		\
351 351
 } while (0)
352 352
 
353
+#undef STAILQ_SWAP
353 354
 #define STAILQ_SWAP(head1, head2, type) do {				\
354 355
 	struct type *swap_first = STAILQ_FIRST(head1);			\
355 356
 	struct type **swap_last = (head1)->stqh_last;			\
... ...
@@ -367,6 +375,7 @@ struct {								\
367 367
 /*
368 368
  * List declarations.
369 369
  */
370
+#undef LIST_HEAD
370 371
 #define	LIST_HEAD(name, type)						\
371 372
 struct name {								\
372 373
 	struct type *lh_first;	/* first element */			\
... ...
@@ -375,6 +384,7 @@ struct name {								\
375 375
 #define	LIST_HEAD_INITIALIZER(head)					\
376 376
 	{ NULL }
377 377
 
378
+#undef LIST_ENTRY
378 379
 #define	LIST_ENTRY(type)						\
379 380
 struct {								\
380 381
 	struct type *le_next;	/* next element */			\
... ...
@@ -469,6 +479,7 @@ struct {								\
469 469
 	((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL :		\
470 470
 	    __containerof((elm)->field.le_prev, struct type, field.le_next))
471 471
 
472
+#undef LIST_REMOVE
472 473
 #define	LIST_REMOVE(elm, field) do {					\
473 474
 	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\
474 475
 	QMD_SAVELINK(oldprev, (elm)->field.le_prev);			\
... ...
@@ -482,6 +493,7 @@ struct {								\
482 482
 	TRASHIT(*oldprev);						\
483 483
 } while (0)
484 484
 
485
+#undef LIST_SWAP
485 486
 #define LIST_SWAP(head1, head2, type, field) do {			\
486 487
 	struct type *swap_tmp = LIST_FIRST((head1));			\
487 488
 	LIST_FIRST((head1)) = LIST_FIRST((head2));			\
... ...
@@ -495,6 +507,7 @@ struct {								\
495 495
 /*
496 496
  * Tail queue declarations.
497 497
  */
498
+#undef TAILQ_HEAD
498 499
 #define	TAILQ_HEAD(name, type)						\
499 500
 struct name {								\
500 501
 	struct type *tqh_first;	/* first element */			\
... ...
@@ -502,9 +515,11 @@ struct name {								\
502 502
 	TRACEBUF							\
503 503
 }
504 504
 
505
+#undef TAILQ_HEAD_INITIALIZER
505 506
 #define	TAILQ_HEAD_INITIALIZER(head)					\
506 507
 	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
507 508
 
509
+#undef TAILQ_ENTRY
508 510
 #define	TAILQ_ENTRY(type)						\
509 511
 struct {								\
510 512
 	struct type *tqe_next;	/* next element */			\
... ...
@@ -607,6 +622,7 @@ struct {								\
607 607
 	QMD_TRACE_HEAD(head);						\
608 608
 } while (0)
609 609
 
610
+#undef TAILQ_INSERT_AFTER
610 611
 #define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
611 612
 	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
612 613
 	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
... ...
@@ -622,6 +638,7 @@ struct {								\
622 622
 	QMD_TRACE_ELEM(&listelm->field);				\
623 623
 } while (0)
624 624
 
625
+#undef TAILQ_INSERT_BEFORE
625 626
 #define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
626 627
 	QMD_TAILQ_CHECK_PREV(listelm, field);				\
627 628
 	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
... ...
@@ -632,6 +649,7 @@ struct {								\
632 632
 	QMD_TRACE_ELEM(&listelm->field);				\
633 633
 } while (0)
634 634
 
635
+#undef TAILQ_INSERT_HEAD
635 636
 #define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
636 637
 	QMD_TAILQ_CHECK_HEAD(head, field);				\
637 638
 	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
... ...
@@ -645,6 +663,7 @@ struct {								\
645 645
 	QMD_TRACE_ELEM(&(elm)->field);					\
646 646
 } while (0)
647 647
 
648
+#undef TAILQ_INSERT_TAIL
648 649
 #define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
649 650
 	QMD_TAILQ_CHECK_TAIL(head, field);				\
650 651
 	TAILQ_NEXT((elm), field) = NULL;				\
... ...
@@ -655,14 +674,17 @@ struct {								\
655 655
 	QMD_TRACE_ELEM(&(elm)->field);					\
656 656
 } while (0)
657 657
 
658
+#undef TAILQ_LAST
658 659
 #define	TAILQ_LAST(head, headname)					\
659 660
 	(*(((struct headname *)((head)->tqh_last))->tqh_last))
660 661
 
661 662
 #define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
662 663
 
664
+#undef TAILQ_PREV
663 665
 #define	TAILQ_PREV(elm, headname, field)				\
664 666
 	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
665 667
 
668
+#undef TAILQ_REMOVE
666 669
 #define	TAILQ_REMOVE(head, elm, field) do {				\
667 670
 	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\
668 671
 	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\
... ...
@@ -681,6 +703,7 @@ struct {								\
681 681
 	QMD_TRACE_ELEM(&(elm)->field);					\
682 682
 } while (0)
683 683
 
684
+#undef TAILQ_SWAP
684 685
 #define TAILQ_SWAP(head1, head2, type, field) do {			\
685 686
 	struct type *swap_first = (head1)->tqh_first;			\
686 687
 	struct type **swap_last = (head1)->tqh_last;			\