Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37183
b: refs/heads/master
c: 11b054f
h: refs/heads/master
i:
  37181: e91d0b3
  37179: 4ba7e95
  37175: 7c18805
  37167: 44c2720
  37151: 3f6e74b
  37119: 59353a1
v: v3
  • Loading branch information
Bryan O'Sullivan authored and Roland Dreier committed Sep 28, 2006
1 parent 4a3afe9 commit beeb425
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c78f6415e964aafd3a91d834970c16b613e421d9
refs/heads/master: 11b054fe1d453954449a86de178bb98274bb86ef
16 changes: 11 additions & 5 deletions trunk/drivers/infiniband/hw/ipath/ipath_mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ static int recv_subn_get_nodeinfo(struct ib_smp *smp,
struct ipath_devdata *dd = to_idev(ibdev)->dd;
u32 vendor, majrev, minrev;

if (smp->attr_mod)
/* GUID 0 is illegal */
if (smp->attr_mod || (dd->ipath_guid == 0))
smp->status |= IB_SMP_INVALID_FIELD;

nip->base_version = 1;
Expand Down Expand Up @@ -131,10 +132,15 @@ static int recv_subn_get_guidinfo(struct ib_smp *smp,
* We only support one GUID for now. If this changes, the
* portinfo.guid_cap field needs to be updated too.
*/
if (startgx == 0)
/* The first is a copy of the read-only HW GUID. */
*p = to_idev(ibdev)->dd->ipath_guid;
else
if (startgx == 0) {
__be64 g = to_idev(ibdev)->dd->ipath_guid;
if (g == 0)
/* GUID 0 is illegal */
smp->status |= IB_SMP_INVALID_FIELD;
else
/* The first is a copy of the read-only HW GUID. */
*p = g;
} else
smp->status |= IB_SMP_INVALID_FIELD;

return reply(smp);
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/infiniband/hw/ipath/ipath_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static ssize_t store_guid(struct device *dev,
struct ipath_devdata *dd = dev_get_drvdata(dev);
ssize_t ret;
unsigned short guid[8];
__be64 nguid;
__be64 new_guid;
u8 *ng;
int i;

Expand All @@ -266,15 +266,18 @@ static ssize_t store_guid(struct device *dev,
&guid[4], &guid[5], &guid[6], &guid[7]) != 8)
goto invalid;

ng = (u8 *) &nguid;
ng = (u8 *) &new_guid;

for (i = 0; i < 8; i++) {
if (guid[i] > 0xff)
goto invalid;
ng[i] = guid[i];
}

dd->ipath_guid = nguid;
if (new_guid == 0)
goto invalid;

dd->ipath_guid = new_guid;
dd->ipath_nguid = 1;

ret = strlen(buf);
Expand Down

0 comments on commit beeb425

Please sign in to comment.