Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp162406ybf; Wed, 26 Feb 2020 10:41:10 -0800 (PST) X-Google-Smtp-Source: APXvYqx96iXyGpP2qPqJs/olsTQ0vECXV00lHDgAOYRi2uBJLWUTOyfbmOYyXIB4Fm8n+vxigFZI X-Received: by 2002:aca:2118:: with SMTP id 24mr343504oiz.28.1582742469909; Wed, 26 Feb 2020 10:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582742469; cv=none; d=google.com; s=arc-20160816; b=bX2upJMqERUSmPmlCERok8949G4mO4y0UpjzmS+Wgnr1An7L3uRof9iUm5nuhgRfZq kMiiN1yxojmZZ+htMA1ho9IWMEAU5Eazhllysx9ycr4ZAz8vR7Tm5HNYT1s5tvkP2zxW TeqSTwNAPvlznZf3SZhWanr9KDJWOPEMMBIILBeE+5M1UrNCozVBbVcrjYj9P87Bciae XfEtr28foNh2SzPw94yhv+1t6bTjwdJ5Hqv7KeqBWd2r8ToFKXYqZt0HvmOORaowNlvG hP6gb4NRaNpAZe4oUuW3QQE44mlthMs96xSsbKNGBYayC/Udukah1l95y0c7XC4MEngi YLwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=4GGF4l4U7/kbDXUUFjPa2eu/bqf5F6upzrLkHeQe7FY=; b=RaEOADCSYkhO9320m3jJfIvGL+I79HHYwEAoX3Gab0zqzScCxeE+qwotVdukeO9+6a WNnK0dyV2BrM4wbf5OlYAQsdni8AICPfiK0nVn+2cBDgNbft93/CFze0JCdy6PRWH3Bm 5KdzaSeiEuESS19JVOvKl6g+F9gXC1+BFCQD8EkX5DF3jC6U3DVYQm1sRS2vD0ZTZbqn rc1LRGQPu1ic52FGczgff8wLwKh0g0Lp6OtrbqtgyNGTrotkyXLyGduj7rt0QKdPQacw ADiiaamfoUZOz4V2f0pwy0aM/f5B9DPX9hD/cRSi9XSfmCBdtWsTIN7rqOxhP6qeVmdy 4Erg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FBK+zwVy; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si130414otg.321.2020.02.26.10.40.56; Wed, 26 Feb 2020 10:41:09 -0800 (PST) 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=@chromium.org header.s=google header.b=FBK+zwVy; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727145AbgBZSku (ORCPT + 99 others); Wed, 26 Feb 2020 13:40:50 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46638 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726998AbgBZSkt (ORCPT ); Wed, 26 Feb 2020 13:40:49 -0500 Received: by mail-pf1-f196.google.com with SMTP id k29so191461pfp.13 for ; Wed, 26 Feb 2020 10:40:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=4GGF4l4U7/kbDXUUFjPa2eu/bqf5F6upzrLkHeQe7FY=; b=FBK+zwVyEoLgoQ57CVtZtTPJfi9gje5UsBooroCLV59Ab/5wgZsun0pvJpO4LI9qyu Vzum3mDZd+PdAkWuMNyQT3MrGeXUDFZu+ixd0Ck48CQgZLgiM8cqbMW8stDZ3vvIhP2g OyI3g2oG+vvDUSlxmbnkew1X1i79ylNpdA8qc= 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; bh=4GGF4l4U7/kbDXUUFjPa2eu/bqf5F6upzrLkHeQe7FY=; b=hMgXiuJr87yAvLRikOKorVOBo3FHaozNk09drSzu4hu8VSP9KwmvUecey08VMtvKuL d2HRIYbRBvcddv1xY/qaEl3khBLcgHsA/nARbkz5F3q19iKLfHWjBF2OFrUHCYxqRjnY 8RS43oXz2QImaa07miV1My2rJ8lly5xDbK1gRprLodd/CCXBe4h5Y/DV4xeLtmdTCU3g o5CUUhyg2U4zw93nNhHWc+5DjcuF7fxUbV1TPv1kwvIbiAdx5sPXlBeA1PosNLylfTeC 7fA/vjnH4fwrzOu/AyxFcLkpFdwo6KGK2EfTduu15fA1gn4M7bVRJLjP15DgiqamFU96 M5yQ== X-Gm-Message-State: APjAAAUuq6TzOTyC8GTjd2IaLF0EyuINvWf9L7E+t/eJspYaRsFZ8HLk 7Q9C+JiaL1eeRLuMbddWVHcqGXgK0Dg= X-Received: by 2002:a65:40c8:: with SMTP id u8mr222956pgp.188.1582742448922; Wed, 26 Feb 2020 10:40:48 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 7sm4003285pfc.21.2020.02.26.10.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 10:40:48 -0800 (PST) Date: Wed, 26 Feb 2020 10:40:47 -0800 From: Kees Cook To: Joel Fernandes Cc: Vasily Averin , LKML , Anton Vorontsov , Colin Cross , Tony Luck Subject: Re: [PATCH v2] pstore: pstore_ftrace_seq_next should increase position index Message-ID: <202002261040.8F21715C@keescook> References: <4e49830d-4c88-0171-ee24-1ee540028dad@virtuozzo.com> <202002251136.3816A79E@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 26, 2020 at 01:36:45PM -0500, Joel Fernandes wrote: > One thing I was not sure about is, if we move "pos" forward but still > return NULL from next(), then does show() need to check if data is > NULL? As below. Otherwise the suggested patch looks sane to me. > > diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c > index 7fbe8f0582205..e3e7370b1a34d 100644 > --- a/fs/pstore/inode.c > +++ b/fs/pstore/inode.c > @@ -101,6 +101,9 @@ static int pstore_ftrace_seq_show(struct seq_file > *s, void *v) > struct pstore_ftrace_seq_data *data = v; > struct pstore_ftrace_record *rec; > > + if (!data) > + return 0; > + > rec = (struct pstore_ftrace_record *)(ps->record->buf + data->off); > > seq_printf(s, "CPU:%d ts:%llu %08lx %08lx %ps <- %pS\n", Ah, good point. I'm not sure, but it's worth checking I think. :) -- Kees Cook