[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH] [WHQL] 64bit OIDs: 4-byte results are a success
> -----Original Message----- > From: win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx [mailto:win-pv-devel- > bounces@xxxxxxxxxxxxxxxxxxxx] On Behalf Of Owen Smith > Sent: 05 March 2015 15:48 > To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Owen Smith > Subject: [win-pv-devel] [PATCH] [WHQL] 64bit OIDs: 4-byte results are a > success > > When buffer is >= 8-bytes, return a 8-byte buffer, > when buffer is >= 4-bytes, return a 4-byte buffer, > else, indicate 8-bytes required and indicate failure > > Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx> ...and applied. Thanks! Paul > --- > src/xennet/adapter.c | 47 ++++++++++++++++++++++++---------------------- > - > 1 file changed, 24 insertions(+), 23 deletions(-) > > diff --git a/src/xennet/adapter.c b/src/xennet/adapter.c > index b094519..f85ce12 100644 > --- a/src/xennet/adapter.c > +++ b/src/xennet/adapter.c > @@ -1151,17 +1151,16 @@ __CopyBuffer( > IN PVOID Buffer, > IN ULONG BufferLength, > IN PVOID Source, > - IN OUT PULONG SourceLength > + IN ULONG SourceLength > ) > { > - if (BufferLength >= *SourceLength) { > - RtlCopyMemory(Buffer, Source, *SourceLength); > + if (BufferLength >= SourceLength) { > + RtlCopyMemory(Buffer, Source, SourceLength); > return NDIS_STATUS_SUCCESS; > - } else { > - *SourceLength = BufferLength; > - RtlCopyMemory(Buffer, Source, *SourceLength); > - return NDIS_STATUS_BUFFER_TOO_SHORT; > } > + > + RtlCopyMemory(Buffer, Source, BufferLength); > + return NDIS_STATUS_BUFFER_TOO_SHORT; > } > > static FORCEINLINE NDIS_STATUS > @@ -1172,14 +1171,14 @@ __SetUlong( > IN OUT PULONG SourceLength > ) > { > + *SourceLength = sizeof(ULONG); > + > if (BufferLength >= sizeof(ULONG)) { > - *(PULONG)Buffer = Source; > - *SourceLength = sizeof(ULONG); > + *(PULONG)Buffer = (ULONG)Source; > return NDIS_STATUS_SUCCESS; > - } else { > - *SourceLength = 0; > - return NDIS_STATUS_BUFFER_TOO_SHORT; > } > + > + return NDIS_STATUS_BUFFER_TOO_SHORT; > } > > static FORCEINLINE NDIS_STATUS > @@ -1190,18 +1189,20 @@ __SetUlong64( > IN OUT PULONG SourceLength > ) > { > + *SourceLength = sizeof(ULONGLONG); > + > if (BufferLength >= sizeof(ULONGLONG)) { > *(PULONGLONG)Buffer = Source; > - *SourceLength = sizeof(ULONGLONG); > return NDIS_STATUS_SUCCESS; > - } else if (BufferLength == sizeof(ULONG)) { > + } > + > + if (BufferLength >= sizeof(ULONG)) { > *(PULONG)Buffer = (ULONG)Source; > *SourceLength = sizeof(ULONG); > - return NDIS_STATUS_BUFFER_TOO_SHORT; > - } else { > - *SourceLength = 0; > - return NDIS_STATUS_BUFFER_TOO_SHORT; > + return NDIS_STATUS_SUCCESS; > } > + > + return NDIS_STATUS_BUFFER_TOO_SHORT; > } > > NDIS_STATUS > @@ -1230,7 +1231,7 @@ AdapterQueryInformation( > ndisStatus = __CopyBuffer(Buffer, > BufferLength, > &Adapter->Capabilities, > - &BytesWritten); > + BytesWritten); > break; > > case OID_PNP_QUERY_POWER: > @@ -1244,7 +1245,7 @@ AdapterQueryInformation( > ndisStatus = __CopyBuffer(Buffer, > BufferLength, > &XennetSupportedOids[0], > - &BytesWritten); > + BytesWritten); > break; > > case OID_GEN_HARDWARE_STATUS: > @@ -1288,7 +1289,7 @@ AdapterQueryInformation( > ndisStatus = __CopyBuffer(Buffer, > BufferLength, > COMPANY_NAME_STR, > - &BytesWritten); > + BytesWritten); > break; > > case OID_GEN_VENDOR_DRIVER_VERSION: > @@ -1336,7 +1337,7 @@ AdapterQueryInformation( > ndisStatus = __CopyBuffer(Buffer, > BufferLength, > &EthernetAddress, > - &BytesWritten); > + BytesWritten); > break; > > case OID_802_3_CURRENT_ADDRESS: > @@ -1347,7 +1348,7 @@ AdapterQueryInformation( > ndisStatus = __CopyBuffer(Buffer, > BufferLength, > &EthernetAddress, > - &BytesWritten); > + BytesWritten); > break; > > case OID_GEN_MAXIMUM_FRAME_SIZE: > -- > 1.9.4.msysgit.1 > > > _______________________________________________ > win-pv-devel mailing list > win-pv-devel@xxxxxxxxxxxxxxxxxxxx > http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |