From patchwork Tue Jun 27 11:48:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 781174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wxkrC19fxz9s71 for ; Tue, 27 Jun 2017 21:55:07 +1000 (AEST) Received: from localhost ([::1]:51865 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPp5E-0004nj-Pj for incoming@patchwork.ozlabs.org; Tue, 27 Jun 2017 07:55:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPozU-0008S0-D7 for qemu-devel@nongnu.org; Tue, 27 Jun 2017 07:49:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPozP-0003zU-JF for qemu-devel@nongnu.org; Tue, 27 Jun 2017 07:49:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37558) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dPozP-0003zG-D5 for qemu-devel@nongnu.org; Tue, 27 Jun 2017 07:49:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 52061C056788; Tue, 27 Jun 2017 11:49:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 52061C056788 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 52061C056788 Received: from thh440s.redhat.com (ovpn-116-48.ams2.redhat.com [10.36.116.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93F9753CE3; Tue, 27 Jun 2017 11:48:58 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Christian Borntraeger Date: Tue, 27 Jun 2017 13:48:19 +0200 Message-Id: <1498564100-10045-14-git-send-email-thuth@redhat.com> In-Reply-To: <1498564100-10045-1-git-send-email-thuth@redhat.com> References: <1498564100-10045-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 27 Jun 2017 11:49:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH 13/14] pc-bios/s390-ccw: Allow loading to address 0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Farman , Farhan Ali , Alexander Graf , Jens Freimann , David Hildenbrand Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Kernels are normally loaded to address 0, so the check for NULL in the TFTP code has to be replaced. Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/libnet/tftp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pc-bios/s390-ccw/libnet/tftp.c b/pc-bios/s390-ccw/libnet/tftp.c index 34f448c..108092b 100644 --- a/pc-bios/s390-ccw/libnet/tftp.c +++ b/pc-bios/s390-ccw/libnet/tftp.c @@ -26,6 +26,7 @@ #define MAX_BLOCKSIZE 1428 #define BUFFER_LEN 256 +#define INVALID_BUFFER ((void *)-1L) #define ENOTFOUND 1 #define EACCESS 2 @@ -45,7 +46,7 @@ /* Local variables */ static unsigned char packet[BUFFER_LEN]; -static unsigned char *buffer = NULL; +static unsigned char *buffer = INVALID_BUFFER; static unsigned short block; static unsigned short blocksize; static char blocksize_str[6]; /* Blocksize string for read request */ @@ -337,7 +338,7 @@ int32_t handle_tftp(int fd, uint8_t *pkt, int32_t packetsize) struct tftphdr *tftp; /* buffer is only set if we are handling TFTP */ - if (buffer == NULL ) + if (buffer == INVALID_BUFFER) return 0; #ifndef __DEBUG__ @@ -536,7 +537,7 @@ int tftp(filename_ip_t * _fn_ip, unsigned char *_buffer, int _len, printf(" Receiving data: "); print_progress(-1, 0); - // Setting buffer to a non-zero address enabled handling of received TFTP packets. + /* Set buffer to a valid address, enables handling of received packets */ buffer = _buffer; set_timer(TICKS_SEC); @@ -579,8 +580,8 @@ int tftp(filename_ip_t * _fn_ip, unsigned char *_buffer, int _len, } } - // Setting buffer to NULL disables handling of received TFTP packets. - buffer = NULL; + /* Setting buffer invalid to disable handling of received packets */ + buffer = INVALID_BUFFER; if (tftp_errno) return tftp_errno;