From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750820AbdE0Qpq (ORCPT ); Sat, 27 May 2017 12:45:46 -0400 Received: from mail-qt0-f182.google.com ([209.85.216.182]:33107 "EHLO mail-qt0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750714AbdE0Qpo (ORCPT ); Sat, 27 May 2017 12:45:44 -0400 MIME-Version: 1.0 In-Reply-To: <1495701227-28809-6-git-send-email-brgl@bgdev.pl> References: <1495701227-28809-1-git-send-email-brgl@bgdev.pl> <1495701227-28809-6-git-send-email-brgl@bgdev.pl> From: Andy Shevchenko Date: Sat, 27 May 2017 19:45:41 +0300 Message-ID: Subject: Re: [PATCH 05/10] gpio: mockup: improve the debugfs input sanitization To: Bartosz Golaszewski Cc: Linus Walleij , Alexandre Courbot , Bamvor Jian Zhang , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 25, 2017 at 11:33 AM, Bartosz Golaszewski wrote: > We're currently only checking the first character of the input to the > debugfs event files, so a string like '0sdfdsf' is valid and indicates > a falling edge event. > > Be more strict and only allow '0', '1', '0\n' & '1\n'. Why not to be so strict and use kstrtobool_from_user(); instead? -- With Best Regards, Andy Shevchenko