From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932784AbcCRNDE (ORCPT ); Fri, 18 Mar 2016 09:03:04 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:32115 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932306AbcCRNDA (ORCPT ); Fri, 18 Mar 2016 09:03:00 -0400 Date: Fri, 18 Mar 2016 16:02:48 +0300 From: Dan Carpenter To: Geert Uytterhoeven Cc: Christian Gromm , Greg KH , driverdevel , Linux Kernel Mailing List Subject: Re: staging: most: warning: =?utf-8?B?4oCY?= =?utf-8?B?bWJv4oCZ?= may be used uninitialized in this function Message-ID: <20160318130248.GD30221@mwanda> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 18, 2016 at 01:41:19PM +0100, Geert Uytterhoeven wrote: > > @@ -249,11 +246,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) > > struct aim_channel *c = filp->private_data; > > > > mutex_lock(&c->io_mutex); > > - if (c->stacked_mbo) { > > - mbo = c->stacked_mbo; > > - goto start_copy; > > - } > > - while ((!kfifo_out(&c->fifo, &mbo, 1)) && (c->dev)) { > > + while (c->dev && !kfifo_peek(&c->fifo, &mbo)) { > > drivers/staging/most/aim-cdev/cdev.c:241: warning: ‘mbo’ may be used > uninitialized in this function > > From looking at the code, it's not obvious to me if this is a false > positive or not. > Can it happen that mbo is not initialized fully, e.g. if less than sizeof(mbo) > bytes have been read from the kfifo? > > Other callers initialize the pointer to NULL, and check the returned length. > It looks like a false positive to me. regards, dan carpenter