Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3534539pxb; Mon, 4 Apr 2022 20:16:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkRfCJtcUsvBz8DIve2jkA7Ba18+lgNUs9wgXCWHWK3Q6ZBNLuGNPuTd5YPXILuIgbgNAK X-Received: by 2002:a17:902:c401:b0:154:1398:a16b with SMTP id k1-20020a170902c40100b001541398a16bmr1388165plk.67.1649128581760; Mon, 04 Apr 2022 20:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649128581; cv=none; d=google.com; s=arc-20160816; b=KotDr/VV2eU6mReSvRX2t8DaogNHhmQnlmUWXKY6wm+b6Y4DRSm3Ic2sMxIM1woy5n X3V26xD4c7vQLOIwtT7XEdA1Lj8N5Dm4iqQkIk0cbxiolh1dtg8FngUor9oDm3tp8fnh hVjKaXworkLzVqBBvJHh0jsdaw1sEctNjXaeJTpatY0arP7ct3qJ4mAOM65rcIXfWeJH ColUihCzV1ho9S+xxNsh56j5vyh2rhwceTRbiz9gjUUrpux8HM6IRC7lZJ1X8R4DQysT mwI6VDsEosnKm9hZJj61oMct55AuvfRzKkh/sjkDk9WjcAL0ey14Q0t+0Wob6wWfwv23 rsyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=pkI30un2e+aw5iEZT5SxMrRKH4N5lxurp/14o6OWyKM=; b=FrRCi1dgJnUAe0pFBwsmRAjzeLOZfGj9EsxI5y1gtxjZgpU8nrJqJgXrFKeejlfPgz o/Y2OfUBZM2JBOh6ByJOBkoWIFoZsRstxNlsveqFW3dEGiZQzK/J4dY8msORLJMMmBpb Ri1fLGdNyFJggNqu/dkX9TouGcMWpRiVVex9uClpKNM+VRnIssoX+hwmaasWG5akhnKy 733b1H/23w4rxoWuxYHhJP4Qrga34MenOl7kqFMPvB/meLIHbTzb0IiU+bakX1aCp7GQ 0tAft40RCvsBZnFAo5TbX6kQNfWW/J80PX9t392Njtg7uSw2KDtvjHfegv5MYn53T4Bn PeHA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c2-20020a170903234200b00155c657775asi1033949plh.32.2022.04.04.20.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 20:16:21 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EF84A2EAE27; Mon, 4 Apr 2022 18:16:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234624AbiDDLtf (ORCPT + 99 others); Mon, 4 Apr 2022 07:49:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376615AbiDDLtd (ORCPT ); Mon, 4 Apr 2022 07:49:33 -0400 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF0E63D1FF; Mon, 4 Apr 2022 04:47:37 -0700 (PDT) Received: by mail-qt1-f173.google.com with SMTP id s11so7424037qtc.3; Mon, 04 Apr 2022 04:47:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pkI30un2e+aw5iEZT5SxMrRKH4N5lxurp/14o6OWyKM=; b=fCC2dFneILSnm5DV9D6VKz6qs14B5AdEQ1gxjpAvUe37gELThHGbyuMXa/ImGlIEve Phf4z6WO9JAoEHTEMsdsy8Q9OrwFbz5fSxsj2N1b8L/Vv9YV7dekyVrO44F7IzA0WYjx 4CDpN4v0t26Je2kIeD8+OIsCYV5U8fUPhF0kKxJFugI9bWVrzL/Ni42nqT6XFMlp9da0 e0uaK5CvZvDoJqgOtJvVzjHRXl5WpYODooWc3prYrFhNhApa4Ch2R7Dz4yhTVMOL6zVZ M85Vy01l3XTy99W9L8iPUg7SIAn3NTuMjHzBECGvK29P1OhMFCIn7jXiyBRi0r0zwHfe j19w== X-Gm-Message-State: AOAM533EkJIpjPTQMAX1fYw2r1MYVXfIZHHIaHB2ffET7REZFKbFEAyB WHRN8Jip+YMgrFteYKV2q/z+CPmNKkzkcg== X-Received: by 2002:ac8:5c4e:0:b0:2e2:104f:7257 with SMTP id j14-20020ac85c4e000000b002e2104f7257mr16988105qtj.544.1649072856476; Mon, 04 Apr 2022 04:47:36 -0700 (PDT) Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com. [209.85.219.174]) by smtp.gmail.com with ESMTPSA id p13-20020a05622a048d00b002e1ce0c627csm8536883qtx.58.2022.04.04.04.47.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Apr 2022 04:47:36 -0700 (PDT) Received: by mail-yb1-f174.google.com with SMTP id f23so17039599ybj.7; Mon, 04 Apr 2022 04:47:36 -0700 (PDT) X-Received: by 2002:a25:45:0:b0:633:96e2:2179 with SMTP id 66-20020a250045000000b0063396e22179mr20536043yba.393.1649072855895; Mon, 04 Apr 2022 04:47:35 -0700 (PDT) MIME-Version: 1.0 References: <20220404084723.79089-1-zheyuma97@gmail.com> <20220404084723.79089-5-zheyuma97@gmail.com> In-Reply-To: <20220404084723.79089-5-zheyuma97@gmail.com> From: Geert Uytterhoeven Date: Mon, 4 Apr 2022 13:47:24 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4/7] video: fbdev: vt8623fb: Error out if 'pixclock' equals zero To: Zheyu Ma Cc: Helge Deller , Linux Fbdev development list , DRI Development , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zheyu, On Mon, Apr 4, 2022 at 1:07 PM Zheyu Ma wrote: > The userspace program could pass any values to the driver through > ioctl() interface. If the driver doesn't check the value of 'pixclock', > it may cause divide error. > > Fix this by checking whether 'pixclock' is zero in the function > vt8623fb_check_var(). > > The following log reveals it: > > [ 47.778727] divide error: 0000 [#1] PREEMPT SMP KASAN PTI > [ 47.778803] RIP: 0010:vt8623fb_set_par+0xecd/0x2210 > [ 47.778870] Call Trace: > [ 47.778872] > [ 47.778909] fb_set_var+0x604/0xeb0 > [ 47.778995] do_fb_ioctl+0x234/0x670 > [ 47.779041] fb_ioctl+0xdd/0x130 > [ 47.779048] do_syscall_64+0x3b/0x90 > > Signed-off-by: Zheyu Ma Thanks for your patch! > --- a/drivers/video/fbdev/vt8623fb.c > +++ b/drivers/video/fbdev/vt8623fb.c > @@ -321,6 +321,9 @@ static int vt8623fb_check_var(struct fb_var_screeninfo *var, struct fb_info *inf > { > int rv, mem, step; > > + if (!var->pixclock) > + return -EINVAL; > + When passed an invalid value, .check_var() is supposed to round up the invalid to a valid value, if possible. > /* Find appropriate format */ > rv = svga_match_format (vt8623fb_formats, var, NULL); > if (rv < 0) 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