Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754087AbdCOUMn (ORCPT ); Wed, 15 Mar 2017 16:12:43 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33531 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753175AbdCOUMj (ORCPT ); Wed, 15 Mar 2017 16:12:39 -0400 Subject: Re: [PATCH net-next v2 2/3] net: dsa: check out-of-range ageing time value To: Vivien Didelot , netdev@vger.kernel.org References: <20170315195350.11059-1-vivien.didelot@savoirfairelinux.com> <20170315195350.11059-3-vivien.didelot@savoirfairelinux.com> Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Andrew Lunn , Jason Cobham From: Florian Fainelli Message-ID: Date: Wed, 15 Mar 2017 13:04:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170315195350.11059-3-vivien.didelot@savoirfairelinux.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 846 Lines: 20 On 03/15/2017 12:53 PM, Vivien Didelot wrote: > If a DSA switch driver cannot program an ageing time value due to it > being out-of-range, switchdev will raise a stack trace before failing. > > To fix this, add ageing_time_min and ageing_time_max members to the > dsa_switch in order for the switch drivers to optionally specify their > supported ageing time limits. > > The DSA core will now check for provided ageing time limits and return > -ERANGE from the switchdev prepare phase if the value is out-of-range. > > Signed-off-by: Vivien Didelot Reviewed-by: Florian Fainelli You could simplify the two changes (and remove the check for ds->ageing_time_{min,max} by setting ds->ageing_time_min to ~0 by default. Absolutely not critical and the code is clear as-is. -- Florian