Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp190725imm; Tue, 18 Sep 2018 19:43:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZM4z9uzOrOuhzXG+JuTRFRY7zS2xuNLjnktxU2YMDzb5Wr0KDe8ijvwqbAZqcbe0eecmEf X-Received: by 2002:a63:904a:: with SMTP id a71-v6mr30007601pge.339.1537325032798; Tue, 18 Sep 2018 19:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537325032; cv=none; d=google.com; s=arc-20160816; b=L9VyIbRDQFf/nC558Qz1l0mcT2ejI9zWyU39p29F/Yqr89Elq+FWJ1QYs9ur8Ku1Im EVxy74h+APJPo9ca+4w9LjG0Nlirf3zq4KjI+RIMWoRBxsZeS7ZpckU4F/BsNvdRfusV dkUDuj1EDeEDb2ASA9/a+qXtqC8EvcpEOSyZDybs3lCRvCrd2aHWcMaMs4N1qkB8sy8I iMYujx53e8cgYHcqGL4DecpwMKD7MPQXSf6OxLoWDTDxHn4iLnN2uV6jW16pVpHI1bkH 2Yeh+tn+erq93uKQruE0RFNJ7tCbeE4HYJbKym5SeJOqcgUCxLdw9vCUTE+xXLpm9t4p SLFg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=KJFDAZTA0Tt+iIcEyLDIdtMfszEcNunZcPcEUluzpvE=; b=OKqUwYfZo9jnrCg96NkOmwiEuAtitkahGoBrjUeJqspe1FeQD3wSKKeoTj7qcXNzss gArtFVFAHm3VI9jFV3ibErsCKy+wgxIkxtJfbrvSq9AxdBQJ9irU3D9I5GCAcScNYrnR X6kYkDuXqb2pE+yEhPJnqrK2X7SAlEqDjthMmpM6n5IKT47mx2QevHc+QvT3BHV4S7Bp /VZ75B5Q6uxElGLYfPIK38nOajnuVKh6jEBZWOHheWvTHD6zyZr6WXGFJVk6gykSJ3HA 2ZmM9zI0gBx3YaIxpA607o9GrrGCpDAiCGmGy4JgyYqIHtQ9haOqIjB6ncjQnUSnhK9I H/XQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si19747550plb.177.2018.09.18.19.43.37; Tue, 18 Sep 2018 19:43:52 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727828AbeISISx convert rfc822-to-8bit (ORCPT + 99 others); Wed, 19 Sep 2018 04:18:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:53168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727326AbeISISx (ORCPT ); Wed, 19 Sep 2018 04:18:53 -0400 Received: from vmware.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4F5232086E; Wed, 19 Sep 2018 02:43:14 +0000 (UTC) Date: Tue, 18 Sep 2018 22:43:12 -0400 From: Steven Rostedt To: Sergey Senozhatsky Cc: He Zhe , pmladek@suse.com, sergey.senozhatsky@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] printk: Fix panic caused by passing log_buf_len to command line Message-ID: <20180918224312.6e9aef50@vmware.local.home> In-Reply-To: <20180919023932.GA14090@jagdpanzerIV> References: <1537291068-443145-1-git-send-email-zhe.he@windriver.com> <20180919015030.GA423@jagdpanzerIV> <6c354803-5341-7237-9ee3-7882252c7483@windriver.com> <20180919023932.GA14090@jagdpanzerIV> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 Sep 2018 11:39:32 +0900 Sergey Senozhatsky wrote: > On (09/19/18 10:27), He Zhe wrote: > > On 2018年09月19日 09:50, Sergey Senozhatsky wrote: > > > On (09/19/18 01:17), zhe.he@windriver.com wrote: > > >> @@ -1048,7 +1048,14 @@ static void __init log_buf_len_update(unsigned size) > > >> /* save requested log_buf_len since it's too early to process it */ > > >> static int __init log_buf_len_setup(char *str) > > >> { > > >> - unsigned size = memparse(str, &str); > > >> + unsigned size; > > > unsigned int size; > > > > This is in v1 but then Steven suggested that it should be split out > > and only keep the pure fix part here. > > Ah, I see. > > Hmm... memparse() returns u64 value. A user *probably* can ask the kernel > to allocate log_buf larger than 'unsigned int'. > > So may be I'd do two fixes here: > > First - switch to u64 size. > Second - check for NULL str. > > > Steven, Petr, what do you think? > I think I would switch it around. Check for NULL first, and then switch to u64. It was always an int, do we need to backport converting it to u64 to stable? The NULL check is a definite, the overflow of int shouldn't crash anything. -- Steve