Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5844388ybi; Wed, 31 Jul 2019 04:16:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6cJ3WOUQKsOt/5MxVgdfDkXdTMeeN2WzGVfvGgisFqWPFzaED24CtzoToqnY6B7sXaoCj X-Received: by 2002:a62:64d4:: with SMTP id y203mr46551939pfb.91.1564571784244; Wed, 31 Jul 2019 04:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564571784; cv=none; d=google.com; s=arc-20160816; b=UaIIrsksqGEA/4w93u7x8Jf7rSq9vnin5tYk07b9K8fGLURJIWKx5L1V5J9F091Jja pasoyS02wTOjmFMyBQzc/EAVrWt8GLCAdQP4+OMIKtTpbTPt1ENY4sKBiYSweqlsjtcn YKkDDpPYOvDuu5X2qK94BumlcvhR2ygLdqKLg0k+DHVklPb7nl3f/w2YY7ez0gDi4uIR BqcaXJtyukXMjEoMldXuCNpLdJrw3MYLak39owmrcoTrOFSDGEUmxncmlz67MyF5vCcj ZCvF5Qmxv5CG867Fa57UizNTdWfhzR6h3GuKt+TscumABrGVFGheVTtnEJHuqBz70qHw be+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=LaPBamwe8LNxxhMMnlugrgaLMOo+ivzahalIgxNO9YM=; b=lZDO0OdvRnkpU2f5o5576CDkBrnnyORTJrua5Pbww1RT6/TD28MmxxN776bw2YcJbi LR0AkxBbYhk3lgACRsE5Pmnnu8jQto2N8f1T767ktYIBpygyhQa4suaawvLyy58VL9uh H9BYQmWIWOtDQuNs6sQsJ8C2EPxQDVBDnZ4vzf46KctJ7meU6RxQHj7HzVbGMOhQdt6w hpC2THv+knHHke2eTvRBbhE+5ASFXc+cZDqehZFQegMpAHX0K/+dkdyy8aRhAP7a7OOX g670EG8ASsUyxfQGANuX+8mg2ZvZRkE02jB+fbmsiR5IXvq4Tca6pjKZhZPv4aMbqRlj kIvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21si29134303pll.169.2019.07.31.04.16.09; Wed, 31 Jul 2019 04:16:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727705AbfGaKKE (ORCPT + 99 others); Wed, 31 Jul 2019 06:10:04 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36070 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbfGaKKE (ORCPT ); Wed, 31 Jul 2019 06:10:04 -0400 Received: by mail-wr1-f67.google.com with SMTP id n4so69084001wrs.3; Wed, 31 Jul 2019 03:10:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LaPBamwe8LNxxhMMnlugrgaLMOo+ivzahalIgxNO9YM=; b=bxRQm8RrZhN9Xc1mBZlynssfeaW+WRGEP49s2j9TdJXHIcYN/jJYvOaM4eBi2Z+mld xshXjZQIBLWU8FbKRdCz3BRyJhTLtHxi9gN8YkXmLTKbdgUNBkElQoprqE4YxSSg9gSV 8f+a770AKt0wCxCQ2A4zN2G+/Uq+pNbzOxaUQ8XO4nDmyhmaD3dOYBPMsDyudvgdcmGa 5+gUqg8tYq0b0Zoc5q1NsGzf04uiZWH73fYTOEHTBquDEmQJpvJ8lxr0ua85bphk51XE yomscBbywE0zB7hpyF22PeLyq3gRsal/BHCstMZwQuwcTfhG31jvatZiZQQGyb+yXy8C GxQg== X-Gm-Message-State: APjAAAUFK5gWQDH/YFoIHfCbYXNzzbnJRAdIorppEJZptN3C2jT0e0Oi Hx9QCL07q5I56SxMMyIQeMWTsNbdXWd1MR3IjHM= X-Received: by 2002:adf:cd81:: with SMTP id q1mr132338071wrj.16.1564567801751; Wed, 31 Jul 2019 03:10:01 -0700 (PDT) MIME-Version: 1.0 References: <1564563689-25863-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 31 Jul 2019 12:09:48 +0200 Message-ID: Subject: Re: [PATCH] phy: renesas: rcar-gen3-usb2: Fix sysfs interface of "role" To: Yoshihiro Shimoda Cc: Kishon Vijay Abraham I , Pavel Machek , Linux Kernel Mailing List , Linux-Renesas , stable Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shimoda-san, On Wed, Jul 31, 2019 at 11:58 AM Yoshihiro Shimoda wrote: > > From: Geert Uytterhoeven, Sent: Wednesday, July 31, 2019 6:27 PM > > On Wed, Jul 31, 2019 at 11:04 AM Yoshihiro Shimoda > > wrote: > > > Since the role_store() uses strncmp(), it's possible to refer > > > out-of-memory if the sysfs data size is smaller than strlen("host"). > > > This patch fixes it by using sysfs_streq() instead of strncmp(). > > > > > > Reported-by: Pavel Machek > > > Fixes: 9bb86777fb71 ("phy: rcar-gen3-usb2: add sysfs for usb role swap") > > > Cc: # v4.10+ > > > Signed-off-by: Yoshihiro Shimoda > > > > Reviewed-by: Geert Uytterhoeven > > Thank you for your review! > > > > --- > > > Just a record. The role_store() doesn't need to check the count because > > > the sysfs_streq() checks the first argument is NULL or not. > > > > Is that wat you mean? sysfs_streq() doesn't seem to check for NULL pointers. > > Oops, sorry for unclear. I meant a NULL-terminated string, not NULL pointer. OK. > > Isn't the real reason that sysfs (kernfs) guarantees that the passed buffer > > is NUL-terminated? > > I doesn't check in detail, but I assume so. I have checked that recently, so it is OK. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds