Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=164ef7a25285bbc42d8177f454b31631ca4d3ec7
Commit:     164ef7a25285bbc42d8177f454b31631ca4d3ec7
Parent:     627934448ec80f823eafd0a7d4b7541515d543a3
Author:     Dave Olson <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 9 22:24:36 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Oct 30 11:05:49 2007 -0700

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 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 6a5dd5c..c61f9da 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -453,7 +453,7 @@ skip_ibchange:
 }
 
 static void handle_supp_msgs(struct ipath_devdata *dd,
-                            unsigned supp_msgs, char msg[512])
+                            unsigned supp_msgs, char *msg, int msgsz)
 {
        /*
         * Print the message unless it's ibc status change only, which
@@ -461,9 +461,9 @@ static void handle_supp_msgs(struct ipath_devdata *dd,
         */
        if (dd->ipath_lasterror & ~INFINIPATH_E_IBSTATUSCHANGED) {
                int iserr;
-               iserr = ipath_decode_err(msg, sizeof msg,
-                               dd->ipath_lasterror &
-                               ~INFINIPATH_E_IBSTATUSCHANGED);
+               iserr = ipath_decode_err(msg, msgsz,
+                                        dd->ipath_lasterror &
+                                        ~INFINIPATH_E_IBSTATUSCHANGED);
                if (dd->ipath_lasterror &
                        ~(INFINIPATH_E_RRCVEGRFULL |
                        INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS))
@@ -492,8 +492,8 @@ static void handle_supp_msgs(struct ipath_devdata *dd,
 }
 
 static unsigned handle_frequent_errors(struct ipath_devdata *dd,
-                                      ipath_err_t errs, char msg[512],
-                                      int *noprint)
+                                      ipath_err_t errs, char *msg,
+                                      int msgsz, int *noprint)
 {
        unsigned long nc;
        static unsigned long nextmsg_time;
@@ -512,7 +512,7 @@ static unsigned handle_frequent_errors(struct ipath_devdata 
*dd,
                                nextmsg_time = nc + HZ * 3;
                }
                else if (supp_msgs) {
-                       handle_supp_msgs(dd, supp_msgs, msg);
+                       handle_supp_msgs(dd, supp_msgs, msg, msgsz);
                        supp_msgs = 0;
                        nmsgs = 0;
                }
@@ -525,14 +525,14 @@ static unsigned handle_frequent_errors(struct 
ipath_devdata *dd,
 
 static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
 {
-       char msg[512];
+       char msg[128];
        u64 ignore_this_time = 0;
        int i, iserr = 0;
        int chkerrpkts = 0, noprint = 0;
        unsigned supp_msgs;
        int log_idx;
 
-       supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint);
+       supp_msgs = handle_frequent_errors(dd, errs, msg, sizeof msg, &noprint);
 
        /* don't report errors that are masked */
        errs &= ~dd->ipath_maskederrs;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to