Skip to content

Commit

Permalink
ntb_hw_switchtec: Check for alignment of the buffer in mw_set_trans()
Browse files Browse the repository at this point in the history
use Marco IS_ALIGNED and BIT_ULL in mw_set_trans() while alignment check
of the buffer
  • Loading branch information
lsgunth authored and wesleywesley committed Aug 9, 2018
1 parent 289c7ed commit 5c83cc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ntb_hw_switchtec.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ static int switchtec_ntb_mw_set_trans(struct ntb_dev *ntb, int idx,
if (xlate_pos < 12)
return -EINVAL;

if (addr & ((1 << xlate_pos) - 1)) {
if (!IS_ALIGNED(addr, BIT_ULL(xlate_pos))) {
/*
* In certain circumstances we can get a buffer that is
* not aligned to its size. (Most of the time
Expand Down

0 comments on commit 5c83cc6

Please sign in to comment.