Commit 561ca66
committed
tracing: Make -ENOMEM the default error for parse_synth_field()
parse_synth_field() returns a pointer and requires that errors get
surrounded by ERR_PTR(). The ret variable is initialized to zero, but should
never be used as zero, and if it is, it could cause a false return code and
produce a NULL pointer dereference. It makes no sense to set ret to zero.
Set ret to -ENOMEM (the most common error case), and have any other errors
set it to something else. This removes the need to initialize ret on *every*
error branch.
Fixes: 761a8c5 ("tracing, synthetic events: Replace buggy strcat() with seq_buf operations")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>1 parent b02414c commit 561ca66
1 file changed
Lines changed: 7 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
587 | | - | |
| 587 | + | |
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
| |||
617 | 617 | | |
618 | 618 | | |
619 | 619 | | |
620 | | - | |
621 | | - | |
| 620 | + | |
622 | 621 | | |
623 | | - | |
| 622 | + | |
624 | 623 | | |
625 | 624 | | |
626 | 625 | | |
| |||
638 | 637 | | |
639 | 638 | | |
640 | 639 | | |
641 | | - | |
642 | | - | |
| 640 | + | |
643 | 641 | | |
644 | | - | |
| 642 | + | |
645 | 643 | | |
646 | 644 | | |
647 | 645 | | |
| |||
653 | 651 | | |
654 | 652 | | |
655 | 653 | | |
| 654 | + | |
656 | 655 | | |
657 | 656 | | |
658 | 657 | | |
| |||
666 | 665 | | |
667 | 666 | | |
668 | 667 | | |
669 | | - | |
670 | | - | |
| 668 | + | |
671 | 669 | | |
672 | | - | |
673 | 670 | | |
674 | 671 | | |
675 | 672 | | |
| |||
0 commit comments