Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp520431ybi; Thu, 30 May 2019 02:21:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLQRy/o98XxUc5aNY8Fj2YXwRZsZJ597lViqn26NIqJFh7cqoFvccLxxhvgg0Sx3AJ3VwA X-Received: by 2002:a17:90a:bd8b:: with SMTP id z11mr2519099pjr.39.1559208113740; Thu, 30 May 2019 02:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559208113; cv=none; d=google.com; s=arc-20160816; b=f/OlKQPxjKNbtfsti7vaAqlRrCnZqYjfyrMpi+QY7OGzHqw+K4IA4cRcUYpVzneEvc jMDOrGXwF5aEx6yFi5hs5JhVa0EjEOSamEGUQMxSzxzPk2NT8u++TF02u4SUR+qYxY6Y cM7tKky7VxbW5/M8ergdOsDbz25Cgdrf2Hd+h/Fc3yJUc4Wy0AnGap3sr8U8xka1gjUA IqW8TwLoL1KeRlpqzbsa/0KWkIPTNIYDuDCL5lwcUgVpZfYo7TU3Mj0XIqza81krLpJH 39JiSSTk/SkcF2M9l9niEmRUvACZbGvN/2VC3hSwKfXH9efdrwNaOLbucV56TOzeS1Jr 9HKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QhuVRUBfgD5dDqIAaCxObwAGWAaU0vki7zU9FvFkW8k=; b=FisDEB8CsgPNKDT+DTgDyTZupfADqHmh2NdDwB6F6Wyei9HqYOyA3YCMiqA2zrELnD oOyYKIXctPtSqoCIOJaMwRPzn50YA8/R+h6nEP309NfEkEAwp0cHsmMyzhyr6k3MQ2Nj XL1gI69894F8SJ3eLhqIoFSZiG1gYLcW+yHaysFXKUlQmSyRcL6RJJR5rkgYzfHc7MOe F2eLqHvhfto+yr7ebpmrHkA053+XgQWgVjluhwhu1I/Q3fBZb8N+J0Bf7cTF7HfPp0ey 1r0lvG3UjHtfRlcMFZHL1d4IY0lycAPL6maIdhdruiiBT7782P8eWqXoVgXv4m3wH7wh 5S9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=j8CORNOx; 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 c7si2542502pgk.411.2019.05.30.02.21.37; Thu, 30 May 2019 02:21:53 -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=j8CORNOx; 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 S1727374AbfE3JTK (ORCPT + 99 others); Thu, 30 May 2019 05:19:10 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42734 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbfE3JTI (ORCPT ); Thu, 30 May 2019 05:19:08 -0400 Received: by mail-pf1-f195.google.com with SMTP id r22so3561595pfh.9; Thu, 30 May 2019 02:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QhuVRUBfgD5dDqIAaCxObwAGWAaU0vki7zU9FvFkW8k=; b=j8CORNOxlpFqVGp77Z3rhaCMMI3PCUoXkIB6ePB72KKW+ESpmSr8FuQ1mlQ2ihWjC0 sk9oVOeZiZ8DERS8XpW3btSS7Pz1zQZdZgeOLqImJfo61Xo8dQB0GnSa2XDMpBTeRtNO N2/2wujIFIWmaflAjv5fTx7BYe+jwGuz41E+odR8Jw2j9DwzkApMTXhJooqm1C4rm7Nd WavOJ+mZB8ef7ts2cQ0M73u/v1PM+MgVkVktNYBzYeFv/EHn2hSP89uyY9D3gnTweDJQ uV3q8/DZVDZXr1Pxpc5LKvdrPjKgW+buvRm+XFiLO9Oirm47aU8v6odJMnYXMEzeXHHd NuYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QhuVRUBfgD5dDqIAaCxObwAGWAaU0vki7zU9FvFkW8k=; b=PLbRfq5YoyFTHprQ3mx6PW9ZVZo+dllXHMMZ6TU/16v4/+zxCG6Z4gplCshegV0pvG SXTL8b8auiCp8NIk6HUf3ZVDYcPMJazU+3+EKwpYO+kgBdxT8VmH6+JZpxsINhh2OJpP 9+yKeadzWbcMkOhiPAX4OLEH84YBjU8qyew9flUtIpwOVwLxdxjBLZZ+n8ZXXV24Qjxc PZOCcZ4/1Il3X4q3rq2P2PMeu8cIJOE3uAnok8nL9HckJ0exqInjSEs/r4CzZYg4/Iba rwuOeQ23ytkXDvS9WiXgqKAhHvdkICPb/5Zi+TNDKJGYt0LPNWB+q7cCC7rRd7FQUFfy hXGQ== X-Gm-Message-State: APjAAAXl8dtPtTUrHfYDbzdUPaKZTafQk3GpsEPswtxl/3PveRLDw8HQ RAyzsnOqpV3hlbatTsIISmc= X-Received: by 2002:a65:6551:: with SMTP id a17mr2611104pgw.1.1559207948070; Thu, 30 May 2019 02:19:08 -0700 (PDT) Received: from zhanggen-UX430UQ ([66.42.35.75]) by smtp.gmail.com with ESMTPSA id t25sm4771120pfq.91.2019.05.30.02.18.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 May 2019 02:19:07 -0700 (PDT) Date: Thu, 30 May 2019 17:18:48 +0800 From: Gen Zhang To: Sergei Shtylyov Cc: paul@paul-moore.com, sds@tycho.nsa.gov, eparis@parisplace.org, ccross@android.com, selinux@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH] hooks: fix a missing-check bug in selinux_add_mnt_opt() Message-ID: <20190530091848.GA3499@zhanggen-UX430UQ> References: <20190530080602.GA3600@zhanggen-UX430UQ> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 30, 2019 at 12:11:33PM +0300, Sergei Shtylyov wrote: > Hello! > > On 30.05.2019 11:06, Gen Zhang wrote: > > >In selinux_add_mnt_opt(), 'val' is allcoted by kmemdup_nul(). It returns > > Allocated? Thanks for your reply, Sergei. I used 'allocated' because kmemdup_nul() does some allocation in its implementation. And its docs descrips: "Return: newly allocated copy of @s with NUL-termination or %NULL in case of error". I think it is proper to use 'allocated' here. But it could be 'assigned', which is better, right? Thanks Gen > > >NULL when fails. So 'val' should be checked. > > > >Signed-off-by: Gen Zhang > [...] > > MBR, Sergei