diff mbox

net: fix incorrect access to pointer

Message ID 1468572212-24209-1-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini July 15, 2016, 8:43 a.m. UTC
This is not dereferencing the pointer, and instead checking only
the value of the pointer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 net/eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Wang July 18, 2016, 5:59 a.m. UTC | #1
On 2016年07月15日 16:43, Paolo Bonzini wrote:
> This is not dereferencing the pointer, and instead checking only
> the value of the pointer.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   net/eth.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/eth.c b/net/eth.c
> index 0be59c2..df81efb 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -211,7 +211,7 @@ void eth_get_protocols(const struct iovec *iov, int iovcnt,
>                                        *l4hdr_off, sizeof(l4hdr_info->hdr.tcp),
>                                        &l4hdr_info->hdr.tcp);
>   
> -            if (istcp) {
> +            if (*istcp) {
>                   *l5hdr_off = *l4hdr_off +
>                       TCP_HEADER_DATA_OFFSET(&l4hdr_info->hdr.tcp);
>   

Applied to -net. Thanks
diff mbox

Patch

diff --git a/net/eth.c b/net/eth.c
index 0be59c2..df81efb 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -211,7 +211,7 @@  void eth_get_protocols(const struct iovec *iov, int iovcnt,
                                      *l4hdr_off, sizeof(l4hdr_info->hdr.tcp),
                                      &l4hdr_info->hdr.tcp);
 
-            if (istcp) {
+            if (*istcp) {
                 *l5hdr_off = *l4hdr_off +
                     TCP_HEADER_DATA_OFFSET(&l4hdr_info->hdr.tcp);