Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cifs: remove bogus debug code

The "end" pointer is either NULL or it points to the next byte to parse.
If there isn't a next byte then dereferencing "end" is an off-by-one out
of bounds error. And, of course, if it's NULL that leads to an Oops.
Printing "*end" doesn't seem very useful so let's delete this code.

Also for the last debug statement, I noticed that it should be printing
"sequence_end" instead of "end" so fix that as well.

Reported-by: Dominik Maier <dmaier@sect.tu-berlin.de>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

Dan Carpenter and committed by
Steve French
d367cb96 1af34fdd

+8 -8
+8 -8
fs/cifs/asn1.c
··· 530 530 return 0; 531 531 } else if ((cls != ASN1_CTX) || (con != ASN1_CON) 532 532 || (tag != ASN1_EOC)) { 533 - cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 0\n", 534 - cls, con, tag, end, *end); 533 + cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 0\n", 534 + cls, con, tag, end); 535 535 return 0; 536 536 } 537 537 ··· 541 541 return 0; 542 542 } else if ((cls != ASN1_UNI) || (con != ASN1_CON) 543 543 || (tag != ASN1_SEQ)) { 544 - cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 1\n", 545 - cls, con, tag, end, *end); 544 + cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 1\n", 545 + cls, con, tag, end); 546 546 return 0; 547 547 } 548 548 ··· 552 552 return 0; 553 553 } else if ((cls != ASN1_CTX) || (con != ASN1_CON) 554 554 || (tag != ASN1_EOC)) { 555 - cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 0\n", 556 - cls, con, tag, end, *end); 555 + cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 0\n", 556 + cls, con, tag, end); 557 557 return 0; 558 558 } 559 559 ··· 564 564 return 0; 565 565 } else if ((cls != ASN1_UNI) || (con != ASN1_CON) 566 566 || (tag != ASN1_SEQ)) { 567 - cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 1\n", 568 - cls, con, tag, end, *end); 567 + cifs_dbg(FYI, "cls = %d con = %d tag = %d sequence_end = %p exit 1\n", 568 + cls, con, tag, sequence_end); 569 569 return 0; 570 570 } 571 571