netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <dborkman@redhat.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>
Subject: [PATCH net] net: mlx5: fix sizeof usage in health_care's reg_handler
Date: Fri,  2 Aug 2013 12:16:17 +0200	[thread overview]
Message-ID: <1375438577-30933-1-git-send-email-dborkman@redhat.com> (raw)

In mlx5's function health_care() the callback handler reg_handler() is
being called that checks the devices registers like:

  reg_handler(dev->pdev, health->health, sizeof(health->health));

health->health is a pointer to the member "struct health_buffer __iomem
*health" of mlx5_core_health, where health buffer itself looks like:

  struct health_buffer {
        __be32          assert_var[5];
        __be32          rsvd0[3];
        __be32          assert_exit_ptr;
        __be32          assert_callra;
        __be32          rsvd1[2];
        ...
        __be16          ext_sync;
  };

Therefore, I strongly assume sizeof(*health->health) is being meant
to be passed as an argument. Interestingly, there are actually no
in-tree users of mlx5_[un]register_health_report_handler(), but some
debugging modules might want to know the correct size instead.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index 748f10a..3592e43 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -101,7 +101,7 @@ static void health_care(struct work_struct *work)
 		spin_lock_irq(&health_lock);
 		if (reg_handler)
 			reg_handler(dev->pdev, health->health,
-				    sizeof(health->health));
+				    sizeof(*health->health));
 
 		list_del_init(&health->list);
 		spin_unlock_irq(&health_lock);
-- 
1.7.11.7

             reply	other threads:[~2013-08-02 10:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 10:16 Daniel Borkmann [this message]
2013-08-02 22:11 ` [PATCH net] net: mlx5: fix sizeof usage in health_care's reg_handler David Miller
2013-08-02 22:43   ` Daniel Borkmann
2013-08-03 21:42     ` Or Gerlitz
2013-08-05  6:33   ` Eli Cohen
2013-08-05  6:39     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375438577-30933-1-git-send-email-dborkman@redhat.com \
    --to=dborkman@redhat.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).