From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751713AbaK2SIX (ORCPT ); Sat, 29 Nov 2014 13:08:23 -0500 Received: from mail-qa0-f54.google.com ([209.85.216.54]:44969 "EHLO mail-qa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751384AbaK2SIW (ORCPT ); Sat, 29 Nov 2014 13:08:22 -0500 MIME-Version: 1.0 In-Reply-To: <5479E11C.8080701@oracle.com> References: <1417046282-31825-1-git-send-email-sasha.levin@oracle.com> <54768059.1080406@oracle.com> <5479E11C.8080701@oracle.com> Date: Sat, 29 Nov 2014 10:08:21 -0800 X-Google-Sender-Auth: 305RSMUjO-1krmpTuPu6K0Nt4FM Message-ID: Subject: Re: [RFC v2 1/2] compiler: use compiler to detect integer overflows From: Linus Torvalds To: Sasha Levin Cc: Ingo Molnar , Andrew Morton , Linux Kernel Mailing List 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 Sat, Nov 29, 2014 at 7:07 AM, Sasha Levin wrote: > > Since we can't just change those to unsigned Sure we can. Just cast them. A signed start/len is bogus crap, it's a random wrong type. If you want to, add a "if (len < 0) return -EINVAL;" before the cast, but treating negative numbers as big positive numbers sounds fine too. > we'd still need to do an overflow > check with signed integers somewhere. Why? It's just a type. User space can't care, and signed values make no sense anyway. Linus