aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMike Marciniszyn <mike.marciniszyn@intel.com>2012-07-23 12:38:15 -0400
committerRoland Dreier <roland@purestorage.com>2012-07-29 23:26:10 -0400
commit5d7fe4efbf0878e0ef12c8f93e7a16c750494b7e (patch)
tree9445b1a2f734770a58db4dc1fef394c7a4f927c0 /drivers/infiniband
parent5dedb9f3bd5bcb186313ea0c0cff8f2c525d4122 (diff)
IB/qib: Fix size of cc_supported_table_entries
Commit 36a8f01cd24b ("IB/qib: Add congestion control agent implementation") tries to store the value 1984 in a u8, which leads to truncation. Fix this by making the member big enough. This bug was detected by a smatch warning. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Ramkrishna Vepa <ramkrishna.vepa@intel.com> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/qib/qib.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
index 6e19ec844d99..7b1b86690024 100644
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -656,6 +656,11 @@ struct qib_pportdata {
656 /* 16 congestion entries with each entry corresponding to a SL */ 656 /* 16 congestion entries with each entry corresponding to a SL */
657 struct ib_cc_congestion_entry_shadow *congestion_entries; 657 struct ib_cc_congestion_entry_shadow *congestion_entries;
658 658
659 /* Maximum number of congestion control entries that the agent expects
660 * the manager to send.
661 */
662 u16 cc_supported_table_entries;
663
659 /* Total number of congestion control table entries */ 664 /* Total number of congestion control table entries */
660 u16 total_cct_entry; 665 u16 total_cct_entry;
661 666
@@ -667,11 +672,6 @@ struct qib_pportdata {
667 672
668 /* CA's max number of 64 entry units in the congestion control table */ 673 /* CA's max number of 64 entry units in the congestion control table */
669 u8 cc_max_table_entries; 674 u8 cc_max_table_entries;
670
671 /* Maximum number of congestion control entries that the agent expects
672 * the manager to send.
673 */
674 u8 cc_supported_table_entries;
675}; 675};
676 676
677/* Observers. Not to be taken lightly, possibly not to ship. */ 677/* Observers. Not to be taken lightly, possibly not to ship. */