Message ID | 1403896261-15464-1-git-send-email-elder@linaro.org |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBDD6VEWXZUOBBU4DW6OQKGQEC3EYAHA@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 336EE200B9 for <linaro@patches.linaro.org>; Fri, 27 Jun 2014 19:11:16 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id eu11sf21890060pac.2 for <linaro@patches.linaro.org>; Fri, 27 Jun 2014 12:11:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=IKNVRFcx9rSDysNFim+Jldm1OG40HMOJZXHprAXBdFo=; b=fymsV1g3ZXPHQAAacAQAQDBaLSoL41Dty8mWc2YGVDsjF2o8+0iy2rz3uTg/kUin3E w9awIneMVHYTdABQT7roJly7ex+AcTXhoaYlHBCFH2nxhBfxMOQy+XYHcLhv6cY+FIUu C7+2mqWEbzcUzapLWrWObAj17b8AL83ZCSHN1Hh+cwoskUDNoNsvILiVpz6Vc4fFVUtq PNqS9F2dt8Qn0/IiJabVB0s9fn5u2mJEQ6VZSMrZXpu9z0ASmwcwCUivi4hPX6+CiutP BBNHZKKdaTa7cMiZzEu7IiVYW3oZB8KP65w/LigBRd/W6ptObSk0mFtYcXG1Oy+kkREy Jj1Q== X-Gm-Message-State: ALoCoQnnsRbe2w7IdBXt5dKnu4kuEYp82ZjsEbCJOLZ7VV8WUOaUe5eYFOEL2MJMlp7Y9RdxWOBk X-Received: by 10.66.165.165 with SMTP id yz5mr13741694pab.37.1403896275263; Fri, 27 Jun 2014 12:11:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.198 with SMTP id 64ls371559qgn.8.gmail; Fri, 27 Jun 2014 12:11:15 -0700 (PDT) X-Received: by 10.58.29.16 with SMTP id f16mr22015501veh.23.1403896275078; Fri, 27 Jun 2014 12:11:15 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id ju5si6860035veb.53.2014.06.27.12.11.15 for <patchwork-forward@linaro.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Jun 2014 12:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id db11so5674487veb.40 for <patchwork-forward@linaro.org>; Fri, 27 Jun 2014 12:11:15 -0700 (PDT) X-Received: by 10.52.117.209 with SMTP id kg17mr16975439vdb.28.1403896274957; Fri, 27 Jun 2014 12:11:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp130546vcb; Fri, 27 Jun 2014 12:11:14 -0700 (PDT) X-Received: by 10.68.200.10 with SMTP id jo10mr32777458pbc.143.1403896274208; Fri, 27 Jun 2014 12:11:14 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vv7si14917230pab.124.2014.06.27.12.11.13; Fri, 27 Jun 2014 12:11:13 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752210AbaF0TLD (ORCPT <rfc822;mturquette@linaro.org> + 27 others); Fri, 27 Jun 2014 15:11:03 -0400 Received: from mail-ig0-f175.google.com ([209.85.213.175]:45223 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbaF0TLC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 27 Jun 2014 15:11:02 -0400 Received: by mail-ig0-f175.google.com with SMTP id h3so2333925igd.2 for <linux-kernel@vger.kernel.org>; Fri, 27 Jun 2014 12:11:01 -0700 (PDT) X-Received: by 10.50.178.196 with SMTP id da4mr14668608igc.6.1403896260993; Fri, 27 Jun 2014 12:11:00 -0700 (PDT) Received: from localhost.localdomain (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id t18sm15933529igr.18.2014.06.27.12.10.59 for <multiple recipients> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Jun 2014 12:11:00 -0700 (PDT) From: Alex Elder <elder@linaro.org> To: akpm@linux-foundation.org Cc: pmladek@suse.cz, jack@suse.cz, joe@perches.com, john.stultz@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH] printk: tweak do_syslog() to match comments Date: Fri, 27 Jun 2014 14:11:01 -0500 Message-Id: <1403896261-15464-1-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: <patchwork-forward.linaro.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: elder@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe>, <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com> |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ea2d5f6..f4a92e8 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1310,7 +1310,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) * for pending data, not the size; return the count of * records, not the length. */ - error = log_next_idx - syslog_idx; + error = log_next_seq - syslog_seq; } else { u64 seq = syslog_seq; u32 idx = syslog_idx;
In do_syslog() there's a path used by kmsg_poll() and kmsg_read() that only needs to know whether there's any data available to read (and not its size). These callers only check for non-zero return. As a shortcut, do_syslog() returns the difference between what has been logged and what has been "seen." The comments say that the "count of records" should be returned but it's not. Instead it returns (log_next_idx - syslog_idx), which is a difference between buffer offsets--and the result could be negative. The behavior is the same (it'll be zero or not in the same cases), but the count of records is more meaningful and it matches what the comments say. So change the code to return that. Signed-off-by: Alex Elder <elder@linaro.org> --- This patch is also available here: http://git.linaro.org/landing-teams/working/broadcom/kernel.git Branch review/do_syslog_tweak kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)