diff options
author | Dave Olson <dave.olson@qlogic.com> | 2007-10-10 01:24:36 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-10-30 14:05:49 -0400 |
commit | 164ef7a25285bbc42d8177f454b31631ca4d3ec7 (patch) | |
tree | 8b1bb151e66af810efdeeb67124ae1ca2fad9f82 /drivers/infiniband | |
parent | 627934448ec80f823eafd0a7d4b7541515d543a3 (diff) |
IB/ipath: Fix incorrect use of sizeof on msg buffer (function argument)
Inside a function declared as
void foo(char bar[512])
the value of sizeof bar is the size of a pointer, not 512. So avoid
constructions like this by passing the size explicitly.
Also reduce the size of the buffer to 128 bytes (512 was overly generous).
Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_intr.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c index 6a5dd5cd773d..c61f9da2964a 100644 --- a/drivers/infiniband/hw/ipath/ipath_intr.c +++ b/drivers/infiniband/hw/ipath/ipath_intr.c | |||
@@ -453,7 +453,7 @@ skip_ibchange: | |||
453 | } | 453 | } |
454 | 454 | ||
455 | static void handle_supp_msgs(struct ipath_devdata *dd, | 455 | static void handle_supp_msgs(struct ipath_devdata *dd, |
456 | unsigned supp_msgs, char msg[512]) | 456 | unsigned supp_msgs, char *msg, int msgsz) |
457 | { | 457 | { |
458 | /* | 458 | /* |
459 | * Print the message unless it's ibc status change only, which | 459 | * Print the message unless it's ibc status change only, which |
@@ -461,9 +461,9 @@ static void handle_supp_msgs(struct ipath_devdata *dd, | |||
461 | */ | 461 | */ |
462 | if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) { | 462 | if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) { |
463 | int iserr; | 463 | int iserr; |
464 | iserr = ipath_decode_err(msg, sizeof msg, | 464 | iserr = ipath_decode_err(msg, msgsz, |
465 | dd->ipath_lasterror & | 465 | dd->ipath_lasterror & |
466 | ~INFINIPATH_E_IBSTATUSCHANGED); | 466 | ~INFINIPATH_E_IBSTATUSCHANGED); |
467 | if (dd->ipath_lasterror & | 467 | if (dd->ipath_lasterror & |
468 | ~(INFINIPATH_E_RRCVEGRFULL | | 468 | ~(INFINIPATH_E_RRCVEGRFULL | |
469 | INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS)) | 469 | INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS)) |
@@ -492,8 +492,8 @@ static void handle_supp_msgs(struct ipath_devdata *dd, | |||
492 | } | 492 | } |
493 | 493 | ||
494 | static unsigned handle_frequent_errors(struct ipath_devdata *dd, | 494 | static unsigned handle_frequent_errors(struct ipath_devdata *dd, |
495 | ipath_err_t errs, char msg[512], | 495 | ipath_err_t errs, char *msg, |
496 | int *noprint) | 496 | int msgsz, int *noprint) |
497 | { | 497 | { |
498 | unsigned long nc; | 498 | unsigned long nc; |
499 | static unsigned long nextmsg_time; | 499 | static unsigned long nextmsg_time; |
@@ -512,7 +512,7 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd, | |||
512 | nextmsg_time = nc + HZ * 3; | 512 | nextmsg_time = nc + HZ * 3; |
513 | } | 513 | } |
514 | else if (supp_msgs) { | 514 | else if (supp_msgs) { |
515 | handle_supp_msgs(dd, supp_msgs, msg); | 515 | handle_supp_msgs(dd, supp_msgs, msg, msgsz); |
516 | supp_msgs = 0; | 516 | supp_msgs = 0; |
517 | nmsgs = 0; | 517 | nmsgs = 0; |
518 | } | 518 | } |
@@ -525,14 +525,14 @@ static unsigned handle_frequent_errors(struct ipath_devdata *dd, | |||
525 | 525 | ||
526 | static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) | 526 | static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs) |
527 | { | 527 | { |
528 | char msg[512]; | 528 | char msg[128]; |
529 | u64 ignore_this_time = 0; | 529 | u64 ignore_this_time = 0; |
530 | int i, iserr = 0; | 530 | int i, iserr = 0; |
531 | int chkerrpkts = 0, noprint = 0; | 531 | int chkerrpkts = 0, noprint = 0; |
532 | unsigned supp_msgs; | 532 | unsigned supp_msgs; |
533 | int log_idx; | 533 | int log_idx; |
534 | 534 | ||
535 | supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint); | 535 | supp_msgs = handle_frequent_errors(dd, errs, msg, sizeof msg, &noprint); |
536 | 536 | ||
537 | /* don't report errors that are masked */ | 537 | /* don't report errors that are masked */ |
538 | errs &= ~dd->ipath_maskederrs; | 538 | errs &= ~dd->ipath_maskederrs; |