Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752255Ab3IIEHa (ORCPT ); Mon, 9 Sep 2013 00:07:30 -0400 Received: from hurricane.the-brannons.com ([64.62.188.119]:39950 "EHLO hurricane.the-brannons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751728Ab3IIEH2 (ORCPT ); Mon, 9 Sep 2013 00:07:28 -0400 X-Greylist: delayed 643 seconds by postgrey-1.27 at vger.kernel.org; Mon, 09 Sep 2013 00:07:28 EDT From: Chris Brannon To: "Raphael S.Carvalho" Cc: William Hubbs , Kirk Reiser , Samuel Thibault , Greg Kroah-Hartman , Andy Shevchenko , Andrew Morton , speakup@braille.uwo.ca, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] staging/speakup/kobjects.c: Code improvement. References: <1378160418-13898-1-git-send-email-raphael.scarv@gmail.com> Date: Sun, 08 Sep 2013 20:56:43 -0700 In-Reply-To: <1378160418-13898-1-git-send-email-raphael.scarv@gmail.com> (Raphael S. Carvalho's message of "Mon, 2 Sep 2013 19:20:18 -0300") Message-ID: <87fvtefy10.fsf@mushroom.PK5001Z> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1206 Lines: 33 "Raphael S.Carvalho" writes: > + /* > + * If voice was just changed, we might need to reset our default > + * pitch and volume. > + */ > + if (param->var_id == VOICE) { > + spk_reset_default_value("pitch", synth->default_pitch, > + value); > + spk_reset_default_value("vol", synth->default_vol, > + value); There's an "invalid read" bug here. You didn't introduce it; it has been there all along. It's possible that value contains a value that is out of range, in which case, the spk_reset_default_value calls could fetch invalid data. The value of ret should be sufficient for determining whether value is in range, so I'd change the condition of the if statement to this: if (param->var_id == VOICE && ret != -ERANGE) { Or possibly better: if (param->var_id == VOICE && ret == 0) { I'd say please resend with that fix, or if not, I can send a one-line patch to be applied after yours. -- Chris -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/