Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3037722ybe; Sun, 8 Sep 2019 05:57:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRN9FAjFkKpSRMXvawtR2qCQpDZPaG6cvxBL2EFVrgkMMnaI+ZazJ8NII6cfV76CDxKMV0 X-Received: by 2002:a63:7d49:: with SMTP id m9mr17504845pgn.161.1567947442620; Sun, 08 Sep 2019 05:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567947442; cv=none; d=google.com; s=arc-20160816; b=dZafLrPsONV9tnyf78B7Nqqkk4G4HHNYZZOigQY1GKONN1V7hNcKTt+HoAYhaFU7OF M8+LeHy84HDVzNGKkTAts7jZ+m5FwU48AFAMkksPY4fh2uG9Ovy1yGanJp2Cbcvj7Cw7 dywbCewuefABXxR88jCMRxKc8/S7md2rHEkeplNRAzlge6AS2K/790wzcRSHfqbyUSKQ 2t5lbBaPxf1lH57G1kUuU6qIlDtBAyvELFTnIyuMPrXCJfSzM4/jDdnkAQGx9uqjT1vU 4rFKaqOX3X1ysStmFul7hPOQPZjLAiUr93YGDGZz1JFZYdhzVy2VsZSQG6fldIh/IDrJ Xyag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RtKloxjFpA2t5GP1ywopBt0f8T0oeF2HbZwg4ACNdgA=; b=mholAFvhp4VXso27ZSxmmCrjWpDiKJuB2+A/3T26Yx4ozJ8Hp71L95f5XoNAHEsqMh AUxicwapfby1NTxj34tKsS9CBScI/oWqeH6hWnG30mSimjJjyBNXaW9gy48ms3YIRrBW R3t3Mg6guXHtSRwRrGpKM26hWvUZjjiZvvdT+u84d6ifQxaWLOSw2vtJheEDplAtwCXH FpHoNstUSwe23uXFpPAlsNKXeW9DdpwC9nUl6j4OcekkTqjIJUodLU860EHf+7N6wVOb G3UQ3jSgi+baLxOYdr8YoljTp9rUir9pq5Jew7YWsDzgS+KJs/ci+shv1ohqs8jZdmF5 E3zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=I3nPu8RM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si9355935pgs.87.2019.09.08.05.57.07; Sun, 08 Sep 2019 05:57:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=I3nPu8RM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbfIHEgh (ORCPT + 99 others); Sun, 8 Sep 2019 00:36:37 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:46280 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbfIHEgg (ORCPT ); Sun, 8 Sep 2019 00:36:36 -0400 Received: by mail-pg1-f195.google.com with SMTP id m3so5780049pgv.13 for ; Sat, 07 Sep 2019 21:36:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RtKloxjFpA2t5GP1ywopBt0f8T0oeF2HbZwg4ACNdgA=; b=I3nPu8RMFPAOjfzb+RUf8Mi5gIkb+Cu56HHzE+93Xw25Xn1IgtLQblsyCgVYhfhfaf 1wh7RGmFtbt1LbBcG3sqfpAPGJbV4nKGpXkvHL7W1Jbz2JCHvacL1js3Kny6IWT6lF4X NNzQTygYqAYbriWrmvEwl2KqraJ9weRhQPeFhi1fOX53BVG0lgCjV3NLg2kzug4TEQRc KPZkGTbYLEXreZrYkpPuPNKZ94ZYHNSnUPsDWfqqAnic7ePQAjjQKft1Yf1xiSyqMJQa AmkJJ52qBm1rLO3hF/659y3XDTahKd7azIvAmZcOR7EHtWc2vboqgjx9vq7FZRLZH5Md kV9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RtKloxjFpA2t5GP1ywopBt0f8T0oeF2HbZwg4ACNdgA=; b=Zp8/13XOZMKdh60q9NUF5vfrbAUQ+2Zsv5N51shNBfV6RRlyYbjwq2YjPpGMN51YsC O87Gw8+faGwhQpnnLutqav2BJlHT/zadkh2hR3QvJhm7Z+cf/ylcFtVOKxIXUAZFMFvT 7tty9UaMA4WJlhOz654Vb+czrAclQPLGfXUTMv7p4kydg+3C3jRfFuKS9aWSa/BhqOEV xog4FV7fzP7xeEIjFpPH6dBSyiIoYcd11tKVcrzPkpNbdYoCxFyxsaFl3/a3+i/nblfR 9prPDnIzuW+uPLTppn9DHy5CUGHzwKyd6WdwzG/8xHKuIWEI+Sr2uWKpQbUIHR2anQvT vFLA== X-Gm-Message-State: APjAAAUe9g0yycG6vKXI2vjhXmJVaH9qRW7rQNtQlgo0NYwPzt1ZQr/2 6mD/4lMfRHSbH7YG3YzDDSxhubQSzMLejA== X-Received: by 2002:a63:2349:: with SMTP id u9mr12722661pgm.214.1567917395763; Sat, 07 Sep 2019 21:36:35 -0700 (PDT) Received: from localhost.localdomain (ip-103-85-38-221.syd.xi.com.au. [103.85.38.221]) by smtp.gmail.com with ESMTPSA id v184sm8435643pgd.34.2019.09.07.21.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Sep 2019 21:36:34 -0700 (PDT) From: Adam Zerella To: labbott@redhat.com, sumit.semwal@linaro.org Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Adam Zerella Subject: [PATCH] staging: android: ion: Replace strncpy() for stracpy() Date: Sun, 8 Sep 2019 14:34:50 +1000 Message-Id: <20190908043450.1078-1-adam.zerella@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using strncpy() does not always terminate the destination string. stracpy() is a alternative function that does, by using this new function we will no longer need to insert a null separator. Signed-off-by: Adam Zerella --- drivers/staging/android/ion/ion.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index e6b1ca141b93..17901bd626be 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -433,8 +433,7 @@ static int ion_query_heaps(struct ion_heap_query *query) max_cnt = query->cnt; plist_for_each_entry(heap, &dev->heaps, node) { - strncpy(hdata.name, heap->name, MAX_HEAP_NAME); - hdata.name[sizeof(hdata.name) - 1] = '\0'; + stracpy(hdata.name, heap->name, MAX_HEAP_NAME); hdata.type = heap->type; hdata.heap_id = heap->id; -- 2.21.0