From owner-freebsd-bugs@FreeBSD.ORG Tue Feb 12 08:20:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8C2ABE2C for ; Tue, 12 Feb 2013 08:20:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 70603CD3; Tue, 12 Feb 2013 08:20:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r1C8K0s0027418; Tue, 12 Feb 2013 08:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r1C8K03o027417; Tue, 12 Feb 2013 08:20:00 GMT (envelope-from gnats) Resent-Date: Tue, 12 Feb 2013 08:20:00 GMT Resent-Message-Id: <201302120820.r1C8K03o027417@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Cc: Sean Bruno Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Christoph Mallon Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C1F23E23 for ; Tue, 12 Feb 2013 08:19:04 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by mx1.freebsd.org (Postfix) with ESMTP id 289A1CCD for ; Tue, 12 Feb 2013 08:19:03 +0000 (UTC) Received: from mailout-de.gmx.net ([10.1.76.35]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0MQKg6-1UUMtW21Yy-00TiKR for ; Tue, 12 Feb 2013 09:19:02 +0100 Received: (qmail invoked by alias); 12 Feb 2013 08:19:02 -0000 Received: from p5B13243E.dip.t-dialin.net (EHLO rotluchs.lokal) [91.19.36.62] by mail.gmx.net (mp035) with SMTP; 12 Feb 2013 09:19:02 +0100 Received: from tron by rotluchs.lokal with local (Exim 4.80.1 (FreeBSD)) (envelope-from ) id 1U5B4v-0006qi-1X for FreeBSD-gnats-submit@freebsd.org; Tue, 12 Feb 2013 09:19:01 +0100 Message-Id: Date: Tue, 12 Feb 2013 09:19:01 +0100 From: Christoph Mallon To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.114 X-GNATS-Notify: Sean Bruno Subject: kern/176052: [PATCH] libi386: Do not unnecessarily cast away const X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Christoph Mallon List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Feb 2013 08:20:00 -0000 >Number: 176052 >Category: kern >Synopsis: [PATCH] libi386: Do not unnecessarily cast away const >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Tue Feb 12 08:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Christoph Mallon >Release: >Organization: >Environment: >Description: In r245424 a cast was introduced to cast away const. This is unnecessary and can be avoided by slightly rearranging the code. >How-To-Repeat: >Fix: Please apply the patch below. --- 0001-libi386-Do-not-unnecessarily-cast-away-const.patch begins here --- >From fbbcc10d3002e3a0a8eb36582443aa4bba8969f6 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Tue, 15 Jan 2013 11:09:09 +0100 Subject: [PATCH] libi386: Do not unnecessarily cast away const. --- sys/boot/i386/libi386/devicename.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/boot/i386/libi386/devicename.c b/sys/boot/i386/libi386/devicename.c index c7705d7..ed2e1c0 100644 --- a/sys/boot/i386/libi386/devicename.c +++ b/sys/boot/i386/libi386/devicename.c @@ -127,17 +127,16 @@ i386_parsedev(struct i386_devdesc **dev, const char *devspec, const char **path) err = EUNIT; goto fail; } - } else { - cp = (char *)np; + np = cp; } - if (*cp && (*cp != ':')) { + if (*np && (*np != ':')) { err = EINVAL; goto fail; } idev->d_unit = unit; if (path != NULL) - *path = (*cp == 0) ? cp : cp + 1; + *path = (*np == '\0') ? np : np + 1; break; case DEVT_ZFS: err = zfs_parsedev((struct zfs_devdesc *)idev, np, path); -- 1.8.1.3 --- 0001-libi386-Do-not-unnecessarily-cast-away-const.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: