From patchwork Wed Mar 16 13:45:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 598377 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qQCVQ3m72z9s6n for ; Thu, 17 Mar 2016 00:47:58 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=YiKl/1MP; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 68FEBA7666; Wed, 16 Mar 2016 14:46:37 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mnSYNcJwekRv; Wed, 16 Mar 2016 14:46:37 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 38F60B380B; Wed, 16 Mar 2016 14:46:22 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6602DB380B for ; Wed, 16 Mar 2016 14:46:12 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sq93jm1P4n6J for ; Wed, 16 Mar 2016 14:46:12 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ig0-f181.google.com (mail-ig0-f181.google.com [209.85.213.181]) by theia.denx.de (Postfix) with ESMTPS id 47BEDB380E for ; Wed, 16 Mar 2016 14:45:55 +0100 (CET) Received: by mail-ig0-f181.google.com with SMTP id ig19so44627385igb.1 for ; Wed, 16 Mar 2016 06:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=DfCxAnfAzegBFABbbXwr59J77bZ+wbgU1ysetnfl7Pc=; b=YiKl/1MPsq+vURZYjFrdJsGt1wcWviLth8mLQLZNBrh1H47vG1Nb9C6Ujh1T0tY6jL vI8quHn0KZ+YMYF5PX9DcgGwm40y/Era56ciDYuOgtqsFn/VN4xAI0V2TnK1IkGFSRZ5 6qBkwJUSTVfBHgxgrZYlz5HWYzUFV1GJYlXF8gBmXoxM1DR8/W+UJOlE57qT7uEvmefS 444rT2b9/9I+swPAEJGki7TOdYJH1S+XcGx79oZdSBjfM1EehbEI16Ud6aPeNP0/QWkt PF4sxancFSKm9BPloam1xlFnOWjghkhljB7fLa5E+y7STZXziLPlE526Fmq0BrwneWgY oY2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=DfCxAnfAzegBFABbbXwr59J77bZ+wbgU1ysetnfl7Pc=; b=LgWxEZtrkeXptq58hAfO9N6sN0vSeawA37k4phzNIZ2KkuW7YcY4T8zUvL3+RHTjWH KK2SrjfS6JruUxjot0VBwG1+H/G7+aorDvUsLaB6lpJpRoEcJCwTArte96F8McGJ+K4U N1zJcP8JYNzPZlWhb6N37n9acjvg/MCdCUkTTJaVfJ1URcNVjexufyd/JxJKSFEb90GM EP7jRh/uQYHpX1kGi6kuBYhoIiBt/36KR9tyA4Iq+N+IjucyBIxR6qcv4C0Ki9xfwYvq 7qhcjCeoBt61nfndQsYYjYea6VnxhPguO9e59oJODyM1VuDmspV5El6dbbV/R1R6/dGe p24Q== X-Gm-Message-State: AD7BkJIJYteVbptQy2cntP/set0R40NGsh7MQkecomCzimyq/R1P2+u1gnEAQEbcvzjnUpnT X-Received: by 10.50.67.83 with SMTP id l19mr1749224igt.42.1458135953830; Wed, 16 Mar 2016 06:45:53 -0700 (PDT) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id y190sm1664402iod.14.2016.03.16.06.45.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Mar 2016 06:45:52 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 2D8AC22115E; Wed, 16 Mar 2016 07:45:51 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 Mar 2016 07:45:34 -0600 Message-Id: <1458135945-13385-5-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.7.0.rc3.207.g0ac5344 In-Reply-To: <1458135945-13385-1-git-send-email-sjg@chromium.org> References: <1458135945-13385-1-git-send-email-sjg@chromium.org> Cc: Tom Rini Subject: [U-Boot] [PATCH 04/14] part_iso: Drop the customer unaligned access functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" One of these is causing a coverity warning. Drop these functions and use the standard U-Boot ones instead. Reported-by: Coverity (CID: 138499) Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- disk/part_iso.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/disk/part_iso.c b/disk/part_iso.c index b83983b..2114faf 100644 --- a/disk/part_iso.c +++ b/disk/part_iso.c @@ -7,6 +7,7 @@ #include #include +#include #include "part_iso.h" #ifdef HAVE_BLOCK_DEVICE @@ -25,26 +26,6 @@ static unsigned char tmpbuf[CD_SECTSIZE]; -/* Convert char[4] in little endian format to the host format integer - */ -static inline unsigned long le32_to_int(unsigned char *le32) -{ - return ((le32[3] << 24) + - (le32[2] << 16) + - (le32[1] << 8) + - le32[0] - ); -} -/* Convert char[2] in little endian format to the host format integer - */ -static inline unsigned short le16_to_int(unsigned char *le16) -{ - return ((le16[1] << 8) + - le16[0] - ); -} - - /* only boot records will be listed as valid partitions */ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, disk_partition_t *info, int verb) @@ -103,7 +84,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num, pbr->ident_str, dev_desc->devnum, part_num); return (-1); } - bootaddr=le32_to_int(pbr->pointer); + bootaddr = get_unaligned_le32(pbr->pointer); PRINTF(" Boot Entry at: %08lX\n",bootaddr); if (blk_dread(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) { if(verb) @@ -203,7 +184,7 @@ found: } switch(pide->boot_media) { case 0x00: /* no emulation */ - info->size=le16_to_int(pide->sec_cnt)>>2; + info->size = get_unaligned_le16(pide->sec_cnt)>>2; break; case 0x01: info->size=2400>>2; break; /* 1.2MByte Floppy */ case 0x02: info->size=2880>>2; break; /* 1.44MByte Floppy */ @@ -211,7 +192,7 @@ found: case 0x04: info->size=2880>>2; break; /* dummy (HD Emulation) */ default: info->size=0; break; } - newblkaddr=le32_to_int(pide->rel_block_addr); + newblkaddr = get_unaligned_le32(pide->rel_block_addr); info->start=newblkaddr; PRINTF(" part %d found @ %lx size %lx\n",part_num,newblkaddr,info->size); return 0;