Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3362453pxb; Mon, 4 Apr 2022 14:42:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcQgxcXO9H2ZxCMZkXAWSsSCEwo8hf1v0/sdcaUNb3fBD0E2fxzeRTl0GGQc5BnJywOKu2 X-Received: by 2002:a65:6956:0:b0:399:1f0e:6172 with SMTP id w22-20020a656956000000b003991f0e6172mr175525pgq.286.1649108555338; Mon, 04 Apr 2022 14:42:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649108555; cv=none; d=google.com; s=arc-20160816; b=Le1Qd6yA/uXJr4jFvIXz9/mt93elcQD1pRVjtcazUz936pzUqrB+Jb8r90Hh1L7Uet Y48g8CVcFBl93La/2aSvYKbeWH7K1jkvKbwytZLwDqkDoS5/VUVkAk/fTvQA93LMf0sK ZVUS5yJ26ODje/E5ngTIzK/0BsdTGiAFUFEgFHYNj2wgQV+7bYD572epaADsvEMm1aKL ejz1kdlzSjtRdUVvcvbRH3XCdgGpT8YBEMg/AlQCjV2xilKUVQ+BDr3EOFA9whIjCfgL yuHE7ETAlN/yqqdhnqe7YSCyZT9b6nlYEpzEmYMMNTQRDuLEeuCdcw/zrTOIOujFCmd6 6x8w== 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=0vrtxx97wpbMiIv6dqlYr09ni3VUiuon0GQZYjngD7U=; b=P5nsfKkBTcB26y8lryZ2wCtA52CVJUYndTqu0yXnPEdbwo3jrz1i1JikxCdrO5tFPF JRnypm1+zL7LOm7J1IaIU2LjDf92o3qQPXOk/1M4rI7cvFPY/BdKx+BanhgXyB4F6Wnh +sLwlNGZqDveuguyeYkLVB9emUJzDTwaU5sDrJlMgC/HucX1p/edgwVP6ExCxhQwmATf erOicN6dWhPbdv+EmeG+Oec1+ByTKiBpk8P6zBlpRgXRkmL+dDC30drCo5+q8OIey+pa w/lvgXsv6lv8iVTQoPGgR9+iH0+oPF76UHQS4ohBc79+Hr2qgC6YPLwkZoKNCY2cY0gS KC+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bg12-20020a056a02010c00b003816043eff0si7026924pgb.485.2022.04.04.14.42.21; Mon, 04 Apr 2022 14:42:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376487AbiDDLs1 (ORCPT + 99 others); Mon, 4 Apr 2022 07:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376455AbiDDLsZ (ORCPT ); Mon, 4 Apr 2022 07:48:25 -0400 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 029273D1EF; Mon, 4 Apr 2022 04:46:30 -0700 (PDT) Received: by mail-qt1-f175.google.com with SMTP id j21so7466948qta.0; Mon, 04 Apr 2022 04:46:29 -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=0vrtxx97wpbMiIv6dqlYr09ni3VUiuon0GQZYjngD7U=; b=Y4yaAmm3bSfP7/yoAfy7Ex0tI04wuGvwDBxTEIj5sr1nMU/oAcYBs+GLAnT6SfMCmf PGaQLyYVn+vV2xoIRDc6S8digk6hJLpfjA3+L8XfjDc/evZkXHL9SKFVoANvQTjJ6wji L+ZUe2gyKR/VRhVDSuQdt9duwHNioSwquWB+JF/6fhmJHV/J3yDvH15rsDnzcVPMdUdK 41oL/l2fFN1tquVqvDJ7u1c7Qexn/ZXM+aU3F9Fw+HjOqiRl3y5PJXY27ZGmrKERrJP2 WwI9fU0+n/9b6/Z3Qhs1cbSS25aK9A5I0DZmeLWlhyq1PNAneb42+77alcZsPKMQj2ok 6Mag== X-Gm-Message-State: AOAM533ofFBGwiPsJMXN/oETRkDjF9BVzc7l6qCBtbYOrSk/EElHCveG vbNqMrRk2wRfxAyazxwgWarPgAhbs579KQ== X-Received: by 2002:a05:622a:1051:b0:2e1:eb06:ecc2 with SMTP id f17-20020a05622a105100b002e1eb06ecc2mr16957921qte.171.1649072788539; Mon, 04 Apr 2022 04:46:28 -0700 (PDT) Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com. [209.85.128.173]) by smtp.gmail.com with ESMTPSA id m4-20020ac85b04000000b002e1dcaed228sm7840681qtw.7.2022.04.04.04.46.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Apr 2022 04:46:28 -0700 (PDT) Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-2eb43ad7909so44370057b3.2; Mon, 04 Apr 2022 04:46:27 -0700 (PDT) X-Received: by 2002:a81:5c2:0:b0:2e5:e4eb:c3e7 with SMTP id 185-20020a8105c2000000b002e5e4ebc3e7mr22191370ywf.62.1649072787360; Mon, 04 Apr 2022 04:46:27 -0700 (PDT) MIME-Version: 1.0 References: <631f03bd-0fdf-9cc8-bf37-89235fb84162@gmx.de> In-Reply-To: <631f03bd-0fdf-9cc8-bf37-89235fb84162@gmx.de> From: Geert Uytterhoeven Date: Mon, 4 Apr 2022 13:46:16 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: =?UTF-8?B?UmU6IFtCVUddIGZiZGV2OiBpNzQwZmI6IERpdmlkZSBlcnJvciB3aGVuIOKAmHZhci0+cA==?= =?UTF-8?B?aXhjbG9ja+KAmSBpcyB6ZXJv?= To: Helge Deller Cc: Zheyu Ma , Linux Fbdev development list , DRI Development , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, 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 Helge, On Sun, Apr 3, 2022 at 5:41 PM Helge Deller wrote: > On 4/3/22 13:26, Zheyu Ma wrote: > > I found a bug in the function i740fb_set_par(). > > Nice catch! > > > When the user calls the ioctl system call without setting the value to > > 'var->pixclock', the driver will throw a divide error. > > > > This bug occurs because the driver uses the value of 'var->pixclock' > > without checking it, as the following code snippet show: > > > > if ((1000000 / var->pixclock) > DACSPEED8) { > > dev_err(info->device, "requested pixclock %i MHz out of range > > (max. %i MHz at 8bpp)\n", > > 1000000 / var->pixclock, DACSPEED8); > > return -EINVAL;x > > } > > > > We can fix this by checking the value of 'var->pixclock' in the > > function i740fb_check_var() similar to commit > > b36b242d4b8ea178f7fd038965e3cac7f30c3f09, or we should set the lowest > > supported value when this field is zero. > > I have no idea about which solution is better. > > Me neither. > I think a solution like commit b36b242d4b8ea178f7fd038965e3cac7f30c3f09 > is sufficient. > > Note that i740fb_set_par() is called in i740fb_resume() as well. > Since this doesn't comes form userspace I think adding a check for > the return value there isn't necessary. > > Would you mind sending a patch like b36b242d4b8ea178f7fd038965e3cac7f30c3f09 ? When passed an invalid value, .check_var() is supposed to round up the invalid to a valid value, if possible. Commit b36b242d4b8ea178 ("video: fbdev: asiliantfb: Error out if 'pixclock' equals zero") does not do that. 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