From patchwork Thu Apr 14 15:05:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neels Hofmeyr X-Patchwork-Id: 610491 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3qm3tG3QSrz9t4c for ; Fri, 15 Apr 2016 01:07:02 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 8AC601CB2E; Thu, 14 Apr 2016 15:07:00 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from einhorn.in-berlin.de (einhorn.in-berlin.de [IPv6:2001:bf0:c000::1:8]) by lists.osmocom.org (Postfix) with ESMTP id 9F46A1CB1E for ; Thu, 14 Apr 2016 15:06:58 +0000 (UTC) X-Envelope-From: nhofmeyr@sysmocom.de X-Envelope-To: Received: from localhost (cable-37-120-29-94.cust.telecolumbus.net [37.120.29.94] (may be forged)) (authenticated bits=0) by einhorn.in-berlin.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id u3EF6wuD029940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Apr 2016 17:06:58 +0200 From: Neels Hofmeyr To: openbsc@lists.osmocom.org Subject: [PATCH] compiler warning: unconstify arg passed to OCTET_STRING_noalloc() Date: Thu, 14 Apr 2016 17:05:27 +0200 Message-Id: <1460646327-23854-1-git-send-email-nhofmeyr@sysmocom.de> X-Mailer: git-send-email 2.1.4 X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" This is after the patch to libasn1c, removing str arg constness. Note the comment added in the code. --- src/ranap_msg_factory.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ranap_msg_factory.c b/src/ranap_msg_factory.c index bdae92e..e87eeaf 100644 --- a/src/ranap_msg_factory.c +++ b/src/ranap_msg_factory.c @@ -180,8 +180,13 @@ struct msgb *ranap_new_msg_dt(uint8_t sapi, const uint8_t *nas, unsigned int nas else ies.sapi = RANAP_SAPI_sapi_0; - /* Avoid copying + later freeing of OCTET STRING */ - OCTET_STRING_noalloc(&ies.nas_pdu, nas, nas_len); + /* + * Avoid copying + later freeing of OCTET STRING. + * To store the pointer in an OCTET_STRING_t without copying, we need + * to un-const *nas. Note: un-consting *nas is safe because ies.nas_pdu + * is only used to store the IEs in dt. + */ + OCTET_STRING_noalloc(&ies.nas_pdu, (uint8_t*)nas, nas_len); /* ies -> dt */ rc = ranap_encode_directtransferies(&dt, &ies);