Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5733680ybi; Wed, 31 Jul 2019 02:29:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv7nQ1Dinkk9niACu8iOd0ta+lnCtGLb219FchV1D52Viz/2AzL6UxD1WfhO4BCz4sBA0Y X-Received: by 2002:a63:c23:: with SMTP id b35mr79090306pgl.265.1564565350294; Wed, 31 Jul 2019 02:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564565350; cv=none; d=google.com; s=arc-20160816; b=kEbuV3luefNxgKln4KBhL22rfQbTi5t2kdOFJxQTYaExFTm9sET6eLX8ZDLJXl6QAR XvYhSRRYWxJlnEsmBtrQbuo474cepNPlIjorOMhd+c0lAeB52oDIk4j7UNabI46wkv+C VPo4GrvhIT2dxsRRKQay9TZhplQFgccVfh0nF2FweWEGW+KFzgn4HDo67p/OqMnqUaPv BSh7RzgSvtEbOFqBa57dX503MtpH70KuoMdgKi+h/JYy6quAhrdGMARMK1+ziZ7btfla hzmE73oUhSU5mmjjA3aJ9UX6LhOSjfby4XtZW40eEGulcPrki30E09qbISuQVPWzOCXd PJag== 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=EGM5RKDve8/AJbKDylbWZIikdzuX+zEV16LFhW7u4Ok=; b=xEqimSTMkqd47asSDY2jTVngNmIKfQ9FFSrSe0JhxTc05eOsFEy22MfrZfBaA9CGTi +qA5j/8d7K3JUxyDJtIN4tYNtrVcAyI/D7hT8DMIB78kp9FvhatEimo9YvC0RbLW7Xx1 y5qJ6KJsoLZCIIB6i1MbVRU7le3XRRZj19hS5jT/x73pn43ZIWJQ2PleD8ReUp07lQuc XPdyrpyDjHgUYvxJJLefsvBeDT8VOxDsEBTz0XFryaG6pdV8J2KlSuicpn2H2b/Nz1eQ a3ki7sroqlHXgOF/ThUhTEieKOgSBrqsvE19z1k1fiCCRoETfKttQ8tlChUjFGG12ZYL XV2g== 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 m37si1153415pje.45.2019.07.31.02.28.55; Wed, 31 Jul 2019 02:29:10 -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 S1728883AbfGaJ1T (ORCPT + 99 others); Wed, 31 Jul 2019 05:27:19 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44301 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727329AbfGaJ1Q (ORCPT ); Wed, 31 Jul 2019 05:27:16 -0400 Received: by mail-wr1-f68.google.com with SMTP id p17so68834040wrf.11; Wed, 31 Jul 2019 02:27:15 -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=EGM5RKDve8/AJbKDylbWZIikdzuX+zEV16LFhW7u4Ok=; b=JENqiz9OBD+afpN0kpc5rEgo8xfGE/dhb+/OW82KY3olCKzgzUWt1SyBXdTVqc+vtY nA61KOD29bO52ZTQK0ZEI3EZvqdNcdwZWZb/b5nyLOIgJyAHpriptBPJWne79zqw6yCx FSO8CjpLkja/nlgItQ0CjtfJX5QePx3GaUbTGUbwuDkWp/TCfOhNsEy1EMZEdKk6rPMu pnC6SgdO7S+T7U1M2iROS0qAbNdvsN4bF4LaNA9HNt88p65qjLHCIHp/v6lRP1/xtQJN Wn7Dq4V9kKxd7UZeAvaQvNiIllmjqKAaJJib266b5cqaBpNH1L52eNFs9TifbLeVIgVz MWHA== X-Gm-Message-State: APjAAAW/WIcPPesnr1ArK7FBMbqd8ZcarpXBd7ib/cWoGYwxdOq0l0M3 NxMeZJWhwFH7FzYsDss1kqMfAvZElechUWSX8TpMoA== X-Received: by 2002:a5d:630c:: with SMTP id i12mr45644695wru.312.1564565234591; Wed, 31 Jul 2019 02:27:14 -0700 (PDT) MIME-Version: 1.0 References: <1564563689-25863-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> In-Reply-To: <1564563689-25863-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> From: Geert Uytterhoeven Date: Wed, 31 Jul 2019 11:27:02 +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: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 > --- > 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. Isn't the real reason that sysfs (kernfs) guarantees that the passed buffer is NUL-terminated? 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